Search in sources :

Example 76 with Task

use of nars.entity.Task in project opennars by opennars.

the class BudgetFunctions method revise.

/**
 * Evaluate the quality of a revision, then de-prioritize the premises
 *
 * @param tTruth The truth value of the judgment in the task
 * @param bTruth The truth value of the belief
 * @param truth The truth value of the conclusion of revision
 * @return The budget for the new task
 */
static BudgetValue revise(final TruthValue tTruth, final TruthValue bTruth, final TruthValue truth, final boolean feedbackToLinks, final nars.control.DerivationContext nal) {
    final float difT = truth.getExpDifAbs(tTruth);
    final Task task = nal.getCurrentTask();
    task.decPriority(1 - difT);
    task.decDurability(1 - difT);
    if (feedbackToLinks) {
        TaskLink tLink = nal.getCurrentTaskLink();
        tLink.decPriority(1 - difT);
        tLink.decDurability(1 - difT);
        TermLink bLink = nal.getCurrentBeliefLink();
        final float difB = truth.getExpDifAbs(bTruth);
        bLink.decPriority(1 - difB);
        bLink.decDurability(1 - difB);
    }
    float dif = truth.getConfidence() - max(tTruth.getConfidence(), bTruth.getConfidence());
    float priority = or(dif, task.getPriority());
    float durability = aveAri(dif, task.getDurability());
    float quality = truthToQuality(truth);
    return new BudgetValue(priority, durability, quality);
}
Also used : BudgetValue(nars.entity.BudgetValue) Task(nars.entity.Task) TermLink(nars.entity.TermLink) TaskLink(nars.entity.TaskLink)

Example 77 with Task

use of nars.entity.Task in project opennars by opennars.

the class Evaluate method execute.

/**
 * To create a quest with a given statement
 * @param args Arguments, a Statement followed by an optional tense
 * @param memory The memory in which the operation is executed
 * @return Immediate results as Tasks
 */
@Override
protected ArrayList<Task> execute(Operation operation, Term[] args, Memory memory) {
    Term content = args[1];
    Sentence sentence = new Sentence(content, Symbols.QUEST_MARK, null, new Stamp(memory));
    BudgetValue budget = new BudgetValue(Parameters.DEFAULT_QUEST_PRIORITY, Parameters.DEFAULT_QUESTION_DURABILITY, 1);
    return Lists.newArrayList(new Task(sentence, budget, true));
}
Also used : BudgetValue(nars.entity.BudgetValue) Task(nars.entity.Task) Stamp(nars.entity.Stamp) Term(nars.language.Term) Sentence(nars.entity.Sentence)

Example 78 with Task

use of nars.entity.Task in project opennars by opennars.

the class Feel method feeling.

/**
 * To get the current value of an internal sensor
 *
 * @param value The value to be checked, in [0, 1]
 * @param memory The memory in which the operation is executed
 * @return Immediate results as Tasks
 */
protected ArrayList<Task> feeling(float value, Memory memory) {
    Stamp stamp = new Stamp(memory, Tense.Present);
    TruthValue truth = new TruthValue(value, Parameters.DEFAULT_JUDGMENT_CONFIDENCE);
    Term predicate = new SetInt(feelingTerm);
    Term content = Inheritance.make(selfSubject, predicate);
    Sentence sentence = new Sentence(content, Symbols.JUDGMENT_MARK, truth, stamp);
    float quality = BudgetFunctions.truthToQuality(truth);
    BudgetValue budget = new BudgetValue(Parameters.DEFAULT_JUDGMENT_PRIORITY, Parameters.DEFAULT_JUDGMENT_DURABILITY, quality);
    return Lists.newArrayList(new Task(sentence, budget, true));
}
Also used : BudgetValue(nars.entity.BudgetValue) Task(nars.entity.Task) Stamp(nars.entity.Stamp) TruthValue(nars.entity.TruthValue) SetInt(nars.language.SetInt) Term(nars.language.Term) Sentence(nars.entity.Sentence)

Aggregations

Task (nars.entity.Task)78 Sentence (nars.entity.Sentence)54 Term (nars.language.Term)37 BudgetValue (nars.entity.BudgetValue)36 TruthValue (nars.entity.TruthValue)34 Stamp (nars.entity.Stamp)25 CompoundTerm (nars.language.CompoundTerm)21 Concept (nars.entity.Concept)18 Conjunction (nars.language.Conjunction)11 Statement (nars.language.Statement)10 Events (nars.io.events.Events)8 Inheritance (nars.language.Inheritance)8 Interval (nars.language.Interval)8 Narsese (nars.io.Narsese)6 SetExt (nars.language.SetExt)6 SetInt (nars.language.SetInt)6 ArrayList (java.util.ArrayList)5 DerivationContext (nars.control.DerivationContext)5 Implication (nars.language.Implication)5 Memory (nars.storage.Memory)5