From 4f9735f6170c58b7cfe058a4c20275d285bdcb2c Mon Sep 17 00:00:00 2001 From: Patrick Hammer <patham9@gmail.com> Date: Wed, 11 Apr 2018 05:00:56 -0400 Subject: [PATCH] Negation fix (caused wrong results when backward inference was involved), and avoiding derivations with confidence<TRUTH_EPSILON, as well as avoiding derivations of quests with implications/equivalences. --- nars_core/nars/control/DerivationContext.java | 23 +++---------------- nars_core/nars/inference/RuleTables.java | 3 --- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/nars_core/nars/control/DerivationContext.java b/nars_core/nars/control/DerivationContext.java index 8e12f4d3c4..070f3589b3 100644 --- a/nars_core/nars/control/DerivationContext.java +++ b/nars_core/nars/control/DerivationContext.java @@ -63,9 +63,9 @@ public class DerivationContext { } public boolean derivedTask(final Task task, final boolean revised, final boolean single, boolean overlapAllowed, boolean addToMemory) { - if(task.sentence.isGoal() && (task.sentence.term instanceof Implication || + if((task.sentence.isGoal() || task.sentence.isQuest()) && (task.sentence.term instanceof Implication || task.sentence.term instanceof Equivalence)) { - return false; //implication and equivalence goals are not supported anymore + return false; //implication and equivalence goals and quests are not supported anymore } if (!task.budget.aboveThreshold()) { @@ -74,7 +74,7 @@ public class DerivationContext { } if (task.sentence != null && task.sentence.truth != null) { float conf = task.sentence.truth.getConfidence(); - if (conf == 0) { + if (conf < Parameters.TRUTH_EPSILON) { //no confidence - we can delete the wrongs out that way. memory.removeTask(task, "Ignored (zero confidence)"); return false; @@ -236,23 +236,6 @@ public class DerivationContext { return null; } - /** - * Shared final operations by all double-premise rules, called from the - * rules except StructuralRules - * - * @param newContent The content of the sentence in task - * @param newTruth The truth value of the sentence in task - * @param newBudget The budget value in task - * @param revisible Whether the sentence is revisible - */ - // public void doublePremiseTask(Term newContent, TruthValue newTruth, BudgetValue newBudget, boolean revisible) { - // if (newContent != null) { - // Sentence taskSentence = currentTask.getSentence(); - // Sentence newSentence = new Sentence(newContent, taskSentence.getPunctuation(), newTruth, newStamp, revisible); - // Task newTask = new Task(newSentence, newBudget, currentTask, currentBelief); - // derivedTask(newTask, false, false); - // } - // } /** * Shared final operations by all single-premise rules, called in * StructuralRules diff --git a/nars_core/nars/inference/RuleTables.java b/nars_core/nars/inference/RuleTables.java index 4a86c8b877..ea6079a1a5 100644 --- a/nars_core/nars/inference/RuleTables.java +++ b/nars_core/nars/inference/RuleTables.java @@ -765,13 +765,10 @@ public class RuleTables { } else if (compound.containsTerm(component)) { StructuralRules.structuralCompound(compound, component, compoundTask, index, nal); } -// } else if ((compound instanceof Negation) && !memory.getCurrentTask().isStructural()) { } else if (compound instanceof Negation) { if (compoundTask) { if (compound.term[0] instanceof CompoundTerm) StructuralRules.transformNegation((CompoundTerm)compound.term[0], nal); - } else { - StructuralRules.transformNegation(compound, nal); } } } -- GitLab