diff --git a/nars_core/nars/inference/RuleTables.java b/nars_core/nars/inference/RuleTables.java index 55931bb8a65e57f97a7a869560e2a050178ff7e8..4a86c8b877ede1fce33ed09e06ae05960a879624 100644 --- a/nars_core/nars/inference/RuleTables.java +++ b/nars_core/nars/inference/RuleTables.java @@ -440,8 +440,10 @@ public class RuleTables { } t1 = beliefStatement.getPredicate(); t2 = taskStatement.getPredicate(); - SyllogisticRules.abdIndCom(t1, t2, taskSentence, belief, figure, nal); - + boolean sensational = SyllogisticRules.abdIndCom(t1, t2, taskSentence, belief, figure, nal); + if(sensational) { + return; + } CompositionalRules.composeCompound(taskStatement, beliefStatement, 0, nal); //if(taskSentence.getOccurenceTime()==Stamp.ETERNAL && belief.getOccurenceTime()==Stamp.ETERNAL) CompositionalRules.introVarOuter(taskStatement, beliefStatement, 0, nal);//introVarImage(taskContent, beliefContent, index, memory); @@ -495,7 +497,10 @@ public class RuleTables { t1 = taskStatement.getSubject(); t2 = beliefStatement.getSubject(); if (!SyllogisticRules.conditionalAbd(t1, t2, taskStatement, beliefStatement, nal)) { // if conditional abduction, skip the following - SyllogisticRules.abdIndCom(t1, t2, taskSentence, belief, figure, nal); + boolean sensational = SyllogisticRules.abdIndCom(t1, t2, taskSentence, belief, figure, nal); + if(sensational) { + return; + } CompositionalRules.composeCompound(taskStatement, beliefStatement, 1, nal); CompositionalRules.introVarOuter(taskStatement, beliefStatement, 1, nal);// introVarImage(taskContent, beliefContent, index, memory); diff --git a/nars_core/nars/inference/SyllogisticRules.java b/nars_core/nars/inference/SyllogisticRules.java index beb3afd5f834cdb2150ca0d435056c13393f208c..7366bc4075b04da8a5785008b5eec916aaa5d304 100644 --- a/nars_core/nars/inference/SyllogisticRules.java +++ b/nars_core/nars/inference/SyllogisticRules.java @@ -125,9 +125,9 @@ public final class SyllogisticRules { * removed? * @param nal Reference to the memory */ - static void abdIndCom(Term term1, Term term2, final Sentence sentence1, final Sentence sentence2, final int figure, final DerivationContext nal) { + static boolean abdIndCom(Term term1, Term term2, final Sentence sentence1, final Sentence sentence2, final int figure, final DerivationContext nal) { if (Statement.invalidStatement(term1, term2) || Statement.invalidPair(term1, term2)) { - return; + return false; } int order1 = sentence1.term.getTemporalOrder(); int order2 = sentence2.term.getTemporalOrder(); @@ -165,6 +165,22 @@ public final class SyllogisticRules { budget3 = BudgetFunctions.forward(truth3, nal); } + if(term1.imagination != null && term2.imagination != null) { + TruthValue T = term1.imagination.AbductionOrComparisonTo(term2.imagination, true); + nal.doublePremiseTask( + Statement.make(NativeOperator.SIMILARITY, term1, term2, TemporalRules.ORDER_NONE), + T, budget3.clone(),false, false); + TruthValue T2 = term1.imagination.AbductionOrComparisonTo(term2.imagination, false); + nal.doublePremiseTask( + Statement.make(NativeOperator.INHERITANCE, term1, term2, TemporalRules.ORDER_NONE), + T2, budget3.clone(),false, false); + TruthValue T3 = term2.imagination.AbductionOrComparisonTo(term1.imagination, false); + nal.doublePremiseTask( + Statement.make(NativeOperator.INHERITANCE, term2, term1, TemporalRules.ORDER_NONE), + T3, budget3.clone(),false, false); + return true; //no need for other syllogistic inference, it were sensational terms, + } //but it would not hurt to allow it either.. but why afford tasks that summarize + //so little evidence in comparison to the amount summarized by the array comparison. long delta2 = 0; while ((term2 instanceof Conjunction) && (((CompoundTerm) term2).term[0] instanceof Interval)) { Interval interval = (Interval) ((CompoundTerm) term2).term[0]; @@ -217,6 +233,7 @@ public final class SyllogisticRules { Statement.make(NativeOperator.SIMILARITY, term1, term2, TemporalRules.ORDER_NONE), truth3, budget3.clone(),false, false); } + return false; } diff --git a/nars_core/nars/language/Term.java b/nars_core/nars/language/Term.java index 5d4b57185904a65dcf24413cb30cbf9f334d1c56..87ff1e441248ce0849cf6825224052a7ab13672f 100644 --- a/nars_core/nars/language/Term.java +++ b/nars_core/nars/language/Term.java @@ -176,7 +176,7 @@ public class Term implements AbstractTerm, Serializable { t.index_variable = index_variable; } t.name = name(); - + t.imagination = imagination; return t; } diff --git a/nars_core/nars/plugin/perception/VisionChannel.java b/nars_core/nars/plugin/perception/VisionChannel.java index 90c5d241eb44b9777a4f8ea4f5dd22fef69fabb6..3c94ba0d4e3222067a6cbf5025e8c0cb0f164583 100644 --- a/nars_core/nars/plugin/perception/VisionChannel.java +++ b/nars_core/nars/plugin/perception/VisionChannel.java @@ -8,6 +8,7 @@ import nars.entity.Task; import nars.entity.TruthValue; import nars.inference.BudgetFunctions; import nars.io.Symbols; +import nars.io.events.OutputHandler.IN; import nars.language.Inheritance; import nars.language.Term; import nars.main.Parameters; @@ -36,6 +37,7 @@ public class VisionChannel extends SensoryChannel { public boolean AddToMatrix(Task t) { Inheritance inh = (Inheritance) t.getTerm(); //channels receive inheritances String cur_subj = inh.getSubject().index_variable.toString(); + nar.emit(IN.class, t); if(!cur_subj.equals(subj)) { //when subject changes, we start to collect from scratch, cnt_updated = 0; //this way multiple matrices can be processed by the same vision channel updated = new boolean[height][width]; @@ -73,7 +75,7 @@ public class VisionChannel extends SensoryChannel { float[][] cpy = new float[height][width]; for(int i=0;i<height;i++) { for(int j=0;j<width;j++) { - cpy[i][j] = cpy[i][j]; + cpy[i][j] = (float) inputs[i][j]; } } VisualSpace vspace = new VisualSpace(nar, cpy, py, px, height, width); diff --git a/nars_core/nars/plugin/perception/VisualSpace.java b/nars_core/nars/plugin/perception/VisualSpace.java index 47a3249820a00d038a0f9ee8172628587c3c728d..96398f772657a6b6f917f55e0c7c2fb5b1bd1c02 100644 --- a/nars_core/nars/plugin/perception/VisualSpace.java +++ b/nars_core/nars/plugin/perception/VisualSpace.java @@ -72,8 +72,8 @@ public class VisualSpace implements ImaginationSpace { TruthValue sim = new TruthValue(1.0f, 0.0f); for(int i=0; i<this.height; i++) { for(int j=0; j<this.width; j++) { - int i2 = (int) (((double) this.height) * kh); - int j2 = (int) (((double) this.width) * kw); + int i2 = (int) (((double) i) * kh); + int j2 = (int) (((double) j) * kw); TruthValue t1 = new TruthValue(cropped[i][j], Parameters.DEFAULT_JUDGMENT_CONFIDENCE); TruthValue t2 = new TruthValue(other.cropped[i2][j2], Parameters.DEFAULT_JUDGMENT_CONFIDENCE); TruthValue t3 = comparison ? TruthFunctions.comparison(t1,t2) : TruthFunctions.abduction(t1,t2); diff --git a/nars_core/nars/storage/Memory.java b/nars_core/nars/storage/Memory.java index 3e02748a530f8345d7347fe50e603b59727a15d6..cc48ffa84a7419bace6ea67a5514db275461f0f1 100644 --- a/nars_core/nars/storage/Memory.java +++ b/nars_core/nars/storage/Memory.java @@ -79,7 +79,6 @@ public class Memory implements Serializable, Iterable<Concept> { //emotion meter keeping track of global emotion public final Emotions emotion = new Emotions(); - public long decisionBlock = 0; public Task lastDecision = null; public boolean allowExecution = true; @@ -143,6 +142,7 @@ public class Memory implements Serializable, Iterable<Concept> { this.seq_current.clear(); cycle = 0; emotion.resetEmotions(); + this.lastDecision = null; resetStatic(); event.emit(ResetEnd.class); }