From 9ba2ddfb3ddbb53aed2125e2845c04c14966023d Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Sun, 7 Jun 2020 16:46:07 -0500 Subject: [PATCH 1/3] Change around directory locations This is required by opencog/atomspace#2679 MapLink can now return back to it's original home, now that the crazy Python dependency is gone. --- opencog/ure/backwardchainer/BIT.cc | 2 +- opencog/ure/backwardchainer/ControlPolicy.cc | 2 +- tests/ure/backwardchainer/GradientUTest.cxxtest | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opencog/ure/backwardchainer/BIT.cc b/opencog/ure/backwardchainer/BIT.cc index 604856dd0f..b6081f82bc 100644 --- a/opencog/ure/backwardchainer/BIT.cc +++ b/opencog/ure/backwardchainer/BIT.cc @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include "BIT.h" diff --git a/opencog/ure/backwardchainer/ControlPolicy.cc b/opencog/ure/backwardchainer/ControlPolicy.cc index d0414dd44a..ef4f348854 100644 --- a/opencog/ure/backwardchainer/ControlPolicy.cc +++ b/opencog/ure/backwardchainer/ControlPolicy.cc @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "../MixtureModel.h" #include "../ActionSelection.h" diff --git a/tests/ure/backwardchainer/GradientUTest.cxxtest b/tests/ure/backwardchainer/GradientUTest.cxxtest index 62564ca365..337bf130a3 100644 --- a/tests/ure/backwardchainer/GradientUTest.cxxtest +++ b/tests/ure/backwardchainer/GradientUTest.cxxtest @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include From d926b17f3bace07deba413a45ac1d62e287764c8 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Fri, 12 Jun 2020 18:04:41 -0500 Subject: [PATCH 2/3] Alter unit test to match new AtomSpace behavior. The changes in opencog/atomspace#2685 alters how the utility `is_constant()` works, which is used by `unify/Unify.cc` which is used by `AndBIT::expand()` which alters the unit test results. The new `is_constant()` is working correctly, however, it is possible that `AndBIT::expand()` is broken or incorrect ... The `is_constant()` is called with an empty variable list, and so indeed, the entire clause is constant. But it does contain a variable, so maybe it was not supposed to be? All the other clauses contain this variable, too, so this seems very suspicious. --- tests/ure/backwardchainer/BITUTest.cxxtest | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tests/ure/backwardchainer/BITUTest.cxxtest b/tests/ure/backwardchainer/BITUTest.cxxtest index 8c7f4a09f5..8bdcc66cd7 100644 --- a/tests/ure/backwardchainer/BITUTest.cxxtest +++ b/tests/ure/backwardchainer/BITUTest.cxxtest @@ -168,19 +168,6 @@ void BITUTest::test_expand_1() " (VariableSet" " )" " (AndLink" - " (PresentLink" - " (TypedVariableLink" - " (VariableNode \"$X\")" - " (TypeNode \"ConceptNode\")" - " )" - " (EvaluationLink" - " (PredicateNode \"contain\")" - " (ListLink" - " (ConceptNode \"treatment-1\")" - " (ConceptNode \"compound-A\")" - " )" - " )" - " )" " (NotLink" " (IdenticalLink" " (LambdaLink" From de7108202c167cbf25d3c4a97f6868a931dad91f Mon Sep 17 00:00:00 2001 From: Nil Geisweiller Date: Tue, 16 Jun 2020 12:48:33 +0300 Subject: [PATCH 3/3] Improve comments for not_in_atomspace and not_constant --- opencog/unify/Unify.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/opencog/unify/Unify.cc b/opencog/unify/Unify.cc index 2bfe4e38af..256a3a479a 100644 --- a/opencog/unify/Unify.cc +++ b/opencog/unify/Unify.cc @@ -493,15 +493,22 @@ Handle Unify::substitute_vardecl(const Handle& vardecl, return createLink(std::move(oset), t); } - +// Return true iff the given handle is not in the given atomspace (if +// any). static bool not_in_atomspace(const Handle& handle, const AtomSpace* atomspace) { return nullptr != atomspace and nullptr == atomspace->get_atom(handle); } -// Is a clause constant, relative to some atomspace? -// Why would it matter whether or not it is in some atomspace? +// Return true iff the given clause is constant and is not in the +// given atomspace. A set of variables is provided to make the +// distinction between variables and variable interpreted as constants +// (they are constants is not in vars). Checking the present of the +// clause in the atomspace matters because we don't want to trigger a +// rule that will produce a term conditioned on the presence of a +// clause that was actually not in the atomspace (that would have been +// turned into a constant due to partial instantiation of a rule). static bool not_constant(const HandleSet& vars, const Handle& clause, const AtomSpace* as)