nars.inference
Class BudgetFunctions

java.lang.Object
  extended by nars.inference.UtilityFunctions
      extended by nars.inference.BudgetFunctions

public final class BudgetFunctions
extends UtilityFunctions

Budget functions for resources allocation


Constructor Summary
BudgetFunctions()
           
 
Method Summary
static void activate(Concept concept, BudgetValue budget)
          Activate a concept by an incoming TaskLink
static BudgetValue backward(TruthValue truth)
          Backward inference result and adjustment, stronger case
static BudgetValue backwardWeak(TruthValue truth)
          Backward inference result and adjustment, weaker case
private static BudgetValue budgetInference(float qual, int complexity)
          Common processing for all inference step
static BudgetValue compoundBackward(Term content)
          Backward inference with CompoundTerm conclusion, stronger case
static BudgetValue compoundBackwardWeak(Term content)
          Backward inference with CompoundTerm conclusion, weaker case
static BudgetValue compoundForward(TruthValue truth, Term content)
          Forward inference with CompoundTerm conclusion
static BudgetValue distributeAmongLinks(BudgetValue b, int n)
          Distribute the budget of a task among the links to it
static void forget(BudgetValue budget, float forgetRate, float relativeThreshold)
          Decrease Priority after an item is used, called in Bag
(package private) static BudgetValue forward(TruthValue truth)
          Forward inference result and adjustment
static void merge(BudgetValue baseValue, BudgetValue adjustValue)
          Merge an item into another one in a bag, when the two are identical except in budget values
static float rankBelief(Judgment judg)
          Determine the rank of a judgment by its confidence and originality (stamp length)
(package private) static BudgetValue revise(TruthValue tTruth, TruthValue bTruth, TruthValue truth, Task task, boolean feedbackToLinks)
          Evaluate the quality of a revision, then de-prioritize the premises
(package private) static BudgetValue solutionEval(Sentence problem, Judgment solution, Task task)
          Evaluate the quality of a belief as a solution to a problem, then reward the belief and de-prioritize the problem
static BudgetValue temporalIndCom(BudgetValue b1, BudgetValue b2, TruthValue t)
          Special treatment for temporal induction and comparison among recent event, no feedback
static float truthToQuality(TruthValue t)
          Determine the quality of a judgment by its truth value alone
(package private) static BudgetValue update(Task task, TruthValue bTruth)
          Update a belief
 
Methods inherited from class nars.inference.UtilityFunctions
and, aveAri, aveGeo, or, w2c
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BudgetFunctions

public BudgetFunctions()
Method Detail

truthToQuality

public static float truthToQuality(TruthValue t)
Determine the quality of a judgment by its truth value alone

Mainly decided by confidence, though binary judgment is also preferred

Parameters:
t - The truth value of a judgment
Returns:
The quality of the judgment, according to truth value only

rankBelief

public static float rankBelief(Judgment judg)
Determine the rank of a judgment by its confidence and originality (stamp length)

Parameters:
judg - The judgment to be ranked
Returns:
The rank of the judgment, according to truth value only

solutionEval

static BudgetValue solutionEval(Sentence problem,
                                Judgment solution,
                                Task task)
Evaluate the quality of a belief as a solution to a problem, then reward the belief and de-prioritize the problem

Parameters:
problem - The problem (question or goal) to be solved
solution - The belief as solution
task - The task to be immediatedly processed, or null for continued process
Returns:
The budget for the new task which is the belief activated, if necessary

revise

static BudgetValue revise(TruthValue tTruth,
                          TruthValue bTruth,
                          TruthValue truth,
                          Task task,
                          boolean feedbackToLinks)
Evaluate the quality of a revision, then de-prioritize the premises

Parameters:
tTruth - The truth value of the judgment in the task
bTruth - The truth value of the belief
truth - The truth value of the conclusion of revision
task - The task to be immediatedly or continuely processed
Returns:
The budget for the new task

update

static BudgetValue update(Task task,
                          TruthValue bTruth)
Update a belief

Parameters:
task - The task containing new belief
bTruth - Truth value of the previous belief
Returns:
Budget value of the updating task

distributeAmongLinks

public static BudgetValue distributeAmongLinks(BudgetValue b,
                                               int n)
Distribute the budget of a task among the links to it

Parameters:
b - The original budget
n - Number of links
Returns:
Budget value for each link

activate

public static void activate(Concept concept,
                            BudgetValue budget)
Activate a concept by an incoming TaskLink

Parameters:
concept - The concept
budget - The budget for the new item

forget

public static void forget(BudgetValue budget,
                          float forgetRate,
                          float relativeThreshold)
Decrease Priority after an item is used, called in Bag

After a constant time, p should become d*p. Since in this period, the item is accessed c*p times, each time p-q should multiple d^(1/(c*p)). The intuitive meaning of the parameter "forgetRate" is: after this number of times of access, priority 1 will become d, it is a system parameter adjustable in run time.

Parameters:
budget - The previous budget value
forgetRate - The budget for the new item
relativeThreshold - The relative threshold of the bag

merge

public static void merge(BudgetValue baseValue,
                         BudgetValue adjustValue)
Merge an item into another one in a bag, when the two are identical except in budget values

Parameters:
baseValue - The budget value to be modified
adjustValue - The budget doing the adjusting

forward

static BudgetValue forward(TruthValue truth)
Forward inference result and adjustment

Parameters:
truth - The truth value of the conclusion
Returns:
The budget value of the conclusion

backward

public static BudgetValue backward(TruthValue truth)
Backward inference result and adjustment, stronger case

Parameters:
truth - The truth value of the belief deriving the conclusion
Returns:
The budget value of the conclusion

backwardWeak

public static BudgetValue backwardWeak(TruthValue truth)
Backward inference result and adjustment, weaker case

Parameters:
truth - The truth value of the belief deriving the conclusion
Returns:
The budget value of the conclusion

compoundForward

public static BudgetValue compoundForward(TruthValue truth,
                                          Term content)
Forward inference with CompoundTerm conclusion

Parameters:
truth - The truth value of the conclusion
content - The content of the conclusion
Returns:
The budget of the conclusion

compoundBackward

public static BudgetValue compoundBackward(Term content)
Backward inference with CompoundTerm conclusion, stronger case

Parameters:
content - The content of the conclusion
Returns:
The budget of the conclusion

compoundBackwardWeak

public static BudgetValue compoundBackwardWeak(Term content)
Backward inference with CompoundTerm conclusion, weaker case

Parameters:
content - The content of the conclusion
Returns:
The budget of the conclusion

budgetInference

private static BudgetValue budgetInference(float qual,
                                           int complexity)
Common processing for all inference step

Parameters:
qual - Quality of the inference
complexity - Syntactic complexity of the conclusion
Returns:
Budget of the conclusion task

temporalIndCom

public static BudgetValue temporalIndCom(BudgetValue b1,
                                         BudgetValue b2,
                                         TruthValue t)
Special treatment for temporal induction and comparison among recent event, no feedback

Parameters:
b1 - Budget value of the first premise
b2 - Budget value of the second premise
t - Truth value of the conclusion
Returns:
Budget value of the conclusion task