From 09e7f49b328ad43d48e360daecd97d15dee14cff Mon Sep 17 00:00:00 2001 From: Patrick Hammer <patham9@gmail.com> Date: Sat, 7 Apr 2018 05:45:56 -0400 Subject: [PATCH] NAL9 improvements, should be introspective enough for Xiang's purposes now when it comes to introspective QA, without else worse performance in any way. --- nal/opennars2/fear.nal | 11 +++++------ nars_core/nars/control/ConceptProcessing.java | 17 ++++++++++++----- nars_core/nars/plugin/mental/Counting.java | 2 +- .../nars/plugin/mental/InternalExperience.java | 18 +++++++++--------- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/nal/opennars2/fear.nal b/nal/opennars2/fear.nal index 044e939b55..32c7e536fd 100644 --- a/nal/opennars2/fear.nal +++ b/nal/opennars2/fear.nal @@ -1,7 +1,6 @@ <{SELF} --> [hurt]>! %0% -<(&/,<a --> A>,+1000) =/> <{SELF} --> [hurt]>>. -<a --> A>. :|: -//make observable for anticipation: -<{SELF} --> [hurt]>. :|: %1.0;0.01% -<(&|,(^want,{SELF},#1,FALSE),(^anticipate,{SELF},#1)) =|> <{SELF} --> [afraid]>>. -<{SELF} --> [afraid]>? \ No newline at end of file +<{SELF} --> [hurt]>. :|: %0% +<(&/,<(*,{SELF},wolf) --> close_to>,+1000) =/> <{SELF} --> [hurt]>>. +<(*,{SELF},wolf) --> close_to>. :|: +<(&|,(^want,{SELF},$1,FALSE),(^anticipate,{SELF},$1)) =|> <(*,{SELF},$1) --> afraid_of>>. +<(*,{SELF},?what) --> afraid_of>? \ No newline at end of file diff --git a/nars_core/nars/control/ConceptProcessing.java b/nars_core/nars/control/ConceptProcessing.java index 8bea715d37..f21f7c6f2a 100644 --- a/nars_core/nars/control/ConceptProcessing.java +++ b/nars_core/nars/control/ConceptProcessing.java @@ -13,15 +13,16 @@ import nars.language.*; import nars.operator.Operation; import nars.plugin.mental.InternalExperience; import nars.io.events.Events; -import nars.storage.LevelBag; - import static nars.inference.LocalRules.revisible; import static nars.inference.LocalRules.revision; import static nars.inference.LocalRules.trySolution; import nars.operator.FunctionOperator; import nars.operator.Operator; import nars.operator.mental.Anticipate; -import static nars.plugin.mental.InternalExperience.MINIMUM_BUDGET_SUMMARY_TO_CREATE_WONDER_EVALUATE; +import nars.operator.mental.Believe; +import nars.operator.mental.Want; +import nars.operator.mental.Evaluate; +import nars.operator.mental.Wonder; public class ConceptProcessing { /** @@ -37,7 +38,13 @@ public class ConceptProcessing { public static boolean processTask(Concept concept, final DerivationContext nal, final Task task) { if(task.isInput()) { if(task.sentence.isJudgment() && !task.sentence.isEternal() && task.sentence.term instanceof Operation) { - TemporalInferenceControl.NewOperationFrame(nal.memory, task); + Operation op = (Operation) task.sentence.term; + Operator o = (Operator) op.getPredicate(); + //only consider these mental ops an operation to track when executed not already when generated as internal event + if(!(o instanceof Believe) && !(o instanceof Want) && !(o instanceof Wonder) + && !(o instanceof Evaluate) && !(o instanceof Anticipate)) { + TemporalInferenceControl.NewOperationFrame(nal.memory, task); + } } concept.observable = true; } @@ -542,7 +549,7 @@ public class ConceptProcessing { if(c.negConfirmation.sentence.term instanceof Implication) { Implication imp = (Implication) c.negConfirmation.sentence.term; Concept ctarget = nal.memory.concept(imp.getPredicate()); - if(ctarget != null && ctarget.getPriority()>=InternalExperience.MINIMUM_BUDGET_SUMMARY_TO_CREATE_ANTICIPATION) { + if(ctarget != null && ctarget.getPriority()>=InternalExperience.MINIMUM_CONCEPT_PRIORITY_TO_CREATE_ANTICIPATION) { ((Anticipate)c.memory.getOperator("^anticipate")).anticipationFeedback(imp.getPredicate(), null, c.memory); } } diff --git a/nars_core/nars/plugin/mental/Counting.java b/nars_core/nars/plugin/mental/Counting.java index 5ff8bace7d..85f88b874f 100644 --- a/nars_core/nars/plugin/mental/Counting.java +++ b/nars_core/nars/plugin/mental/Counting.java @@ -38,7 +38,7 @@ public class Counting implements Plugin { return; Task task = (Task)a[0]; - if(task.getPriority() < InternalExperience.MINIMUM_BUDGET_SUMMARY_TO_CREATE) { + if(task.getPriority() < InternalExperience.MINIMUM_PRIORITY_TO_CREATE_WANT_BELIEVE_ETC) { return; } diff --git a/nars_core/nars/plugin/mental/InternalExperience.java b/nars_core/nars/plugin/mental/InternalExperience.java index d60dbcb2a5..7014132ac0 100644 --- a/nars_core/nars/plugin/mental/InternalExperience.java +++ b/nars_core/nars/plugin/mental/InternalExperience.java @@ -33,9 +33,9 @@ import nars.operator.Operator; */ public class InternalExperience implements Plugin, EventObserver { - public static float MINIMUM_BUDGET_SUMMARY_TO_CREATE=0.4f; //0.92 - public static float MINIMUM_BUDGET_SUMMARY_TO_CREATE_WONDER_EVALUATE=0.4f; - public static float MINIMUM_BUDGET_SUMMARY_TO_CREATE_ANTICIPATION=0.25f; + public static float MINIMUM_PRIORITY_TO_CREATE_WANT_BELIEVE_ETC=0.3f; + public static float MINIMUM_PRIORITY_TO_CREATE_WONDER_EVALUATE=0.3f; + public static float MINIMUM_CONCEPT_PRIORITY_TO_CREATE_ANTICIPATION=0.1f; //internal experience has less durability? public static final float INTERNAL_EXPERIENCE_PROBABILITY=0.0001f; @@ -71,17 +71,17 @@ public class InternalExperience implements Plugin, EventObserver { public double getMinCreationBudgetSummary() { - return MINIMUM_BUDGET_SUMMARY_TO_CREATE; + return MINIMUM_PRIORITY_TO_CREATE_WANT_BELIEVE_ETC; } public void setMinCreationBudgetSummary(double val) { - MINIMUM_BUDGET_SUMMARY_TO_CREATE=(float) val; + MINIMUM_PRIORITY_TO_CREATE_WANT_BELIEVE_ETC=(float) val; } public double getMinCreationBudgetSummaryWonderEvaluate() { - return MINIMUM_BUDGET_SUMMARY_TO_CREATE_WONDER_EVALUATE; + return MINIMUM_PRIORITY_TO_CREATE_WONDER_EVALUATE; } public void setMinCreationBudgetSummaryWonderEvaluate(double val) { - MINIMUM_BUDGET_SUMMARY_TO_CREATE_WONDER_EVALUATE=(float) val; + MINIMUM_PRIORITY_TO_CREATE_WONDER_EVALUATE=(float) val; } private Memory memory; @@ -190,12 +190,12 @@ public class InternalExperience implements Plugin, EventObserver { // (!OLD_BELIEVE_WANT_EVALUATE_WONDER_STRATEGY && (task.sentence.punctuation==Symbols.QUESTION_MARK || task.sentence.punctuation==Symbols.QUEST_MARK))) { { if(task.sentence.punctuation == Symbols.QUESTION_MARK || task.sentence.punctuation == Symbols.QUEST_MARK) { - if(task.getPriority()<MINIMUM_BUDGET_SUMMARY_TO_CREATE_WONDER_EVALUATE) { + if(task.getPriority()<MINIMUM_PRIORITY_TO_CREATE_WONDER_EVALUATE) { return false; } } else - if(task.getPriority()<MINIMUM_BUDGET_SUMMARY_TO_CREATE) { + if(task.getPriority()<MINIMUM_PRIORITY_TO_CREATE_WANT_BELIEVE_ETC) { return false; } } -- GitLab