/** * 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 public ClassicalBudgetValue revise(TruthValue tTruth, TruthValue bTruth, TruthValue truth, bool feedbackToLinks, nars.control.DerivationContext nal) { float difT = truth.getExpDifAbs(tTruth); ClassicalTask task = nal.currentTask; task.budget.decPriority(1 - difT); task.budget.decDurability(1 - difT); /* commented because links are not jet implemented * if (feedbackToLinks) { * TaskLink tLink = nal.currentTaskLink; * tLink.decPriority(1 - difT); * tLink.decDurability(1 - difT); * TermLink bLink = nal.currentBeliefLink; * float difB = truth.getExpDifAbs(bTruth); * bLink.decPriority(1 - difB); * bLink.decDurability(1 - difB); * } */ float dif = truth.confidence - Math.Max(tTruth.confidence, bTruth.confidence); float priority = UtilityFunctions.or(dif, task.budget.priority); float durability = UtilityFunctions.aveAri(dif, task.budget.durability); float quality = truthToQuality(truth); /* * if (priority < 0) { * memory.nar.output(ERR.class, * new RuntimeException("BudgetValue.revise resulted in negative priority; set to 0")); * priority = 0; * } * if (durability < 0) { * memory.nar.output(ERR.class, * new RuntimeException("BudgetValue.revise resulted in negative durability; set to 0; aveAri(dif=" + dif + ", task.getDurability=" + task.getDurability() +") = " + durability)); * durability = 0; * } * if (quality < 0) { * memory.nar.output(ERR.class, * new RuntimeException("BudgetValue.revise resulted in negative quality; set to 0")); * quality = 0; * } */ return(new ClassicalBudgetValue(priority, durability, quality)); }