Trying to implement path reasoning on Predicates but running into inference problems.

89 views
Skip to first unread message

Alexander Gabriel

unread,
Jan 8, 2020, 9:39:31 AM1/8/20
to opencog
Hiya!

I'm using opencog in an agri-robotics project. What I'm trying to do is reason over a map/graph of nodes to find out if there is a free path from the robot to a human co-worker. To that end I introduced predicates like this:

EvaluationLink(
       
PredicateNode("linked"),
       
ListLink(ConceptNode("WayPoint001"), ConceptNode("WayPoint002")))

in this example for waypoint concept pairs 1-2, 2-3, 3-4, 4-5, 5-6, 6-7, 7-8, 8-9, 9-10.

and the following inference rule (because I couldn't find PLN rule that covers this case):

         deduction_rule = BindLink(
        VariableList(
            TypedVariableLink(
                VariableNode('$A'),
                TypeNode('ConceptNode')),
            TypedVariableLink(
                VariableNode('$B'),
                TypeNode('ConceptNode')),
            TypedVariableLink(
                VariableNode('$C'),
                TypeNode('ConceptNode'))),
        AndLink(
            EvaluationLink(
                PredicateNode("linked"),
                ListLink(
                    VariableNode('$A'),
                    VariableNode('$B'))),
            EvaluationLink(
                PredicateNode("linked"),
                ListLink(
                    VariableNode('$B'),
                    VariableNode('$C'))),
            NotLink(
                IdenticalLink(
                    VariableNode('$A'),
                    VariableNode('$C')))),
        ExecutionOutputLink(
            GroundedSchemaNode('py: deduction_formula'),
            ListLink(
                EvaluationLink(
                    PredicateNode("linked"),
                    ListLink(
                        VariableNode('$A'),
                        VariableNode('$C'))),
                EvaluationLink(
                    PredicateNode("linked"),
                    ListLink(
                        VariableNode('$A'),
                        VariableNode('$B'))),
                EvaluationLink(
                    PredicateNode("linked"),
                    ListLink(
                        VariableNode('$B'),
                        VariableNode('$C'))))))
    deduction_rule_name = DefinedSchemaNode("linked-deduction-rule")
    DefineLink(
        deduction_rule_name,
        deduction_rule)
    MemberLink(deduction_rule_name, deduction_rbs)
def deduction_formula(AC, AB, BC):
    tv1
= AB.tv
    tv2
= BC.tv
   
if tv1.mean > 0.5 and tv2.mean > 0.5 and tv1.confidence > 0.5 and tv2.confidence > 0.5:
        AC
.tv = TruthValue(1, 1)
   
else:
        AC
.tv = TruthValue(0, 0)
         
return AC  


When I now run the backward chainer on my KB with a query like:

query = EvaluationLink(
       
PredicateNode("linked"),
       
ListLink(ConceptNode("WayPoint001"), ConceptNode("WayPoint004")))

that works fine:
(SetLink   (EvaluationLink     (PredicateNode "linked")    (ListLink       (ConceptNode "WayPoint001")      (ConceptNode "WayPoint004")    )  ))
(stv 1.000000 0.000000)

but when I run it over a longer distance like this:

query = EvaluationLink
(
        
PredicateNode("linked"),
        
ListLink(ConceptNode("WayPoint001"), ConceptNode("WayPoint005")))


the inference fails to produce the correct truth value:

(SetLink   (EvaluationLink     (PredicateNode "linked")    (ListLink       (ConceptNode "WayPoint001")      (ConceptNode "WayPoint005")    )  ))
(stv 1.000000 0.000000)


I also seem to misunderstand how inference works because if I try to use the EvaluationLink part (now with VariableNodes) in a GetLink query like this:(so I can combine it with my other constraints), that only returns pairs of Waypoint concepts that I have set explicitly, but none that follow from the inference rule.
        query = GetLink(
            
VariableList(
                
VariableNode("origin"),
                
VariableNode("destination")),
                
EvaluationLink(
                    
PredicateNode("linked"),
                    
ListLink(
                        
VariableNode("origin"),

                        
VariableNode("destination"))))


Any help is highly appreciated.
Best, 
Alex


Nil Geisweiller

unread,
Jan 10, 2020, 1:20:01 AM1/10/20
to ope...@googlegroups.com
Hi Alex,

On 1/8/20 4:39 PM, Alexander Gabriel wrote:
> and the following inference rule (because I couldn't find PLN rule that
> covers this case):

The existing deduction rules

https://github.com/opencog/pln/blob/master/opencog/pln/rules/term/deduction.scm

are only defined for implication and inheritance links, so if you were
to use them you'd have to formulate the semantics of `linked` in these
terms. Let know if you want more guidance on that. That is said writing
your own rules is a perfectly fine way to go and in fact better if you
wish to have full control over the inference process.

> When I now run the backward chainer on my KB with a query like:
>
> |
> query =EvaluationLink(
> PredicateNode("linked"),
> ListLink(ConceptNode("WayPoint001"),ConceptNode("WayPoint004")))
> |
>
> that works fine:
> |
> (SetLink(EvaluationLink(PredicateNode"linked")(ListLink(ConceptNode"WayPoint001")(ConceptNode"WayPoint004"))))
> (stv 1.000000 0.000000)
> |

The truth value (stv 1 0) however doesn't seem right.

>
> but when I run it over a longer distance like this:
> |
>
> query = EvaluationLink(
> PredicateNode("linked"),
> ListLink(ConceptNode("WayPoint001"),ConceptNode("WayPoint005")))
>
> |
>
> the inference fails to produce the correct truth value:
>
> |
> (SetLink(EvaluationLink(PredicateNode"linked")(ListLink(ConceptNode"WayPoint001")(ConceptNode"WayPoint005"))))
> (stv 1.000000 0.000000)
> |

That answers looks like the previous one, with the likely wrong default TV.

>
>
> I also seem to misunderstand how inference works because if I try to use
> the EvaluationLink part (now with VariableNodes) in a GetLink query like
> this:(so I can combine it with my other constraints), that only returns
> pairs of Waypoint concepts that I have set explicitly, but none that
> follow from the inference rule.
> |
>         query =GetLink(
> VariableList(
> VariableNode("origin"),
> VariableNode("destination")),
> EvaluationLink(
> PredicateNode("linked"),
> ListLink(
> VariableNode("origin"),
>
> VariableNode("destination"))))
> |

The results obtained by inference should normally be added to your
atomspace and thus the query should return them.

So something unintended seems to be happening. Can you point me to the
full script of your experiment?

Nil

Alexander Gabriel

unread,
Jan 10, 2020, 5:59:10 AM1/10/20
to opencog


Am Freitag, 10. Januar 2020 06:20:01 UTC schrieb Nil:

The existing deduction rules

https://github.com/opencog/pln/blob/master/opencog/pln/rules/term/deduction.scm

are only defined for implication and inheritance links, so if you were
to use them you'd have to formulate the semantics of `linked` in these
terms. Let know if you want more guidance on that. That is said writing
your own rules is a perfectly fine way to go and in fact better if you
wish to have full control over the inference process.


Yes, I defined my own deduction rule to do that, help would be greatly appreciated, there are a few other things I'm still struggling with, but let's focus on the current predicament first.



The truth value (stv 1 0) however doesn't seem right.

Yes, it should be above zero strength even for GetLink results, right?
Is there a way to avoid adding the query to the atomspace in python?


So something unintended seems to be happening. Can you point me to the
full script of your experiment?

I boiled the test code down a bit to make it easier to parse. You can find it here
The whole project is somewhat more involved, but I can point you to that as well, if you're interested.

Thank you so much :)

Alex

Nil Geisweiller

unread,
Jan 10, 2020, 7:45:48 AM1/10/20
to ope...@googlegroups.com, Alexander Gabriel
Hi Alex,

On 1/10/20 12:59 PM, Alexander Gabriel wrote:
> I boiled the test code down a bit to make it easier to parse. You can
> find it here
> <https://gist.github.com/alexander-gabriel/8e4593e76120752cbccb9a5c73cec691>.

1. I've never used the Python binding, but I would think/hope that you
don't need to invoke scheme to configure it. Can someone comment on
that?

2. You don't need `GetLink` in the query, and the variable declaration
can be given as optional argument (I don't know the syntax in
Python).

That makes me think, maybe we should consider introducing a

BackwardChainerGetLink

or such, and run that instead of calling a specialized BackwardChainer
function. What do you guys (including Alex) think?

Nil

>
> The whole project is somewhat more involved, but I can point you to that
> as well, if you're interested.
>
> Thank you so much :)
>
> Alex
>
> --
> You received this message because you are subscribed to the Google
> Groups "opencog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/c43e51ac-69d1-4b54-a14b-3b0e176eec5b%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/c43e51ac-69d1-4b54-a14b-3b0e176eec5b%40googlegroups.com?utm_medium=email&utm_source=footer>.

Vitaly Bogdanov

unread,
Jan 10, 2020, 8:12:04 AM1/10/20
to opencog
>1. I've never used the Python binding, but I would think/hope that you
>    don't need to invoke scheme to configure it. Can someone comment on
>    that?

The following Python code:

  MemberLink(DefinedSchemaNode("conditional-full-instantiation-implication-meta-rule-name"), ConceptNode("rbs"))
  ExecutionLink(SchemaNode("URE:maximum-iterations"), ConceptNode("rbs"), NumberNode("30"))

can be used instead of Scheme:

  (ure-add-rule rbs conditional-full-instantiation-implication-meta-rule-name)
  (ure-set-maximum-iterations rbs 30)

>That makes me think, maybe we should consider introducing a
>
>BackwardChainerGetLink

Make sense for me. It could be used to embed backward chainer calls into process of reasoning itself.

Best regards,
Vitaly

Alexander Gabriel

unread,
Jan 10, 2020, 8:33:12 AM1/10/20
to opencog


Am Freitag, 10. Januar 2020 12:45:48 UTC schrieb Nil:
Hi Alex,

On 1/10/20 12:59 PM, Alexander Gabriel wrote:
> I boiled the test code down a bit to make it easier to parse. You can
> find it here
> <https://gist.github.com/alexander-gabriel/8e4593e76120752cbccb9a5c73cec691>.

1. I've never used the Python binding, but I would think/hope that you
    don't need to invoke scheme to configure it. Can someone comment on
    that?

2. You don't need `GetLink` in the query, and the variable declaration
    can be given as optional argument (I don't know the syntax in
    Python).

It doesn't look like I can add the variables using an optional argument:
/* "../../../../opencog/cython/opencog/backwardchainer.pyx":12
 * 
 * 
 * cdef class BackwardChainer:             # <<<<<<<<<<<<<<
 *     cdef cBackwardChainer * chainer
 *     cdef AtomSpace _as
 */
struct __pyx_obj_7opencog_3ure_BackwardChainer {
  PyObject_HEAD
  opencog::BackwardChainer *chainer;
  struct __pyx_obj_7opencog_9atomspace_AtomSpace *_as;
  struct __pyx_obj_7opencog_9atomspace_AtomSpace *_trace_as;
  struct __pyx_obj_7opencog_9atomspace_AtomSpace *_control_as;
};

I have no idea what the trace_as and control_as are used for.


Alexander Gabriel

unread,
Jan 10, 2020, 8:58:46 AM1/10/20
to opencog
Hi Vitaly!
 
The following Python code:

  MemberLink(DefinedSchemaNode("conditional-full-instantiation-implication-meta-rule-name"), ConceptNode("rbs"))
  ExecutionLink(SchemaNode("URE:maximum-iterations"), ConceptNode("rbs"), NumberNode("30"))

can be used instead of Scheme:

  (ure-add-rule rbs conditional-full-instantiation-implication-meta-rule-name)
  (ure-set-maximum-iterations rbs 30)

When I try to do that with rules defined in scheme like this:
execute_code = \
   
'''
    (use-modules (opencog rule-engine))
    (load-from-path "/home/rasberry/git/ure/tests/ure/rules/bc-deduction-rule.scm")
    (define rbs (Concept "deduction-rule-base"))
    (ure-set-complexity-penalty rbs 0.1)
    (EvaluationLink (stv 0 1)
        (PredicateNode "URE:attention-allocation")
        (ConceptNode "deduction-rule-base")
    )
    '''

rbs
= ConceptNode("deduction-rule-base")
   
InheritanceLink(
        rbs
,
       
ConceptNode("URE"))
scheme_eval
(atomspace, execute_code)
MemberLink(DefinedSchemaNode("bc-deduction-rule-name"), rbs)

the error I get during backward chaining is:

Traceback (most recent call last):
  File "bdi/inference_test.py", line 380, in <module>
    query)
  File "opencog/backwardchainer.pyx", line 35, in opencog.ure.BackwardChainer.__cinit__ (/home/rasberry/git/ure/build/opencog/cython/opencog/ure.cpp:1993)
RuntimeError: Cannot find defined hypergraph for atom (DefinedSchemaNode "bc-deduction-rule-name") ; [1114839971276947956][1]
 (/home/rasberry/git/atomspace/opencog/atoms/core/UniqueLink.cc:125)

It works fine on rules defined in python though.

Linas Vepstas

unread,
Jan 10, 2020, 3:24:17 PM1/10/20
to opencog
Hi Alex,

The following caught my eye:

On Wed, Jan 8, 2020 at 8:39 AM Alexander Gabriel <goo...@4d6.de> wrote:
H
def deduction_formula(AC, AB, BC):
    tv1
= AB.tv
    tv2
= BC.tv
   
if tv1.mean > 0.5 and tv2.mean > 0.5 and tv1.confidence > 0.5 and tv2.confidence > 0.5:
        AC
.tv = TruthValue(1, 1)
   
else:
        AC
.tv = TruthValue(0, 0)
         
return AC  


Existing PLN rules do use formulas written in scheme/python, but I believe it would be faster to use native atomese for formulas. as demonstrated here:


The reason these are faster is that they avoid the overhead of entering/exiting python or scheme, and the related inefficiencies of unbundling arguments and wrapping return values.

This is a relatively minor point, and for a demo, scheme or python formulas are sufficient, but for anything that you expect to run quickly, the native formulas would be better.

--linas

--
cassette tapes - analog TV - film cameras - you

Alexander Gabriel

unread,
Jan 10, 2020, 3:49:25 PM1/10/20
to opencog
Hi Linas!
 
This is a relatively minor point, and for a demo, scheme or python formulas are sufficient, but for anything that you expect to run quickly, the native formulas would be better.
 
Thanks for the tip! :)
Do you have any idea why the formula/code fails to produce proper inference? That would really help me.

Best,
Alex

Linas Vepstas

unread,
Jan 10, 2020, 3:55:46 PM1/10/20
to opencog
I don't know how PLN actually works; Nil would be the expert on that.

Strange thing is: gmail said "five new messages", so I assumed you and Nil were talking about it. But when I clicked through, there weren't any messages, like they just disappeared... !??

-- Linas

Matthew Ikle

unread,
Jan 10, 2020, 4:08:54 PM1/10/20
to 'Nil Geisweiller' via opencog
Hmmm. The code snippet I saw looks nothing like what the PLN deduction rule should look like, but rather a heuristic that binarizes the result perhaps for efficiency or for some specialized use case. As Linas says, Nil might know more about why that deduction rule is coded the way it is. The actual deduction rule would be more complex.

—matt

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/CAHrUA373zoPYi2A%3DBkXV4cz0BVSgDPPYsc6r14QRz3GtnXPb%2BA%40mail.gmail.com.

Linas Vepstas

unread,
Jan 10, 2020, 4:37:26 PM1/10/20
to opencog
Hi Matt, Hi Alex:

First Alex: As Nil already noted, the results you posted look reasonable, except that the truth value was insane, given the code snippets you posted. I see two possibilities:
-- in addition to running your rule, some other rules are running, and generating a different TV. Maybe some other rules you created and forgot to delete? Maybe some other rules in PLN?
-- there is a bug in python, causing a bogus TV to be set. Seems unlikely but always possible.

Matt,
Why do you say "looks nothing like what the PLN deduction rule should look like"?  The point of the URE & chainers was to allow anyone to create arbitrary rule sets, with whatever formulas they wanted.  Now, indeed, this particular rule might not look like a textbook-PLN rule, but it looks like a perfectly valid user-defined rule to me.  (There is also an unrelated conversation about the efficiency of using URE for crisp-logic, but that is for some other discussion thread.)

--linas

Linas Vepstas

unread,
Jan 10, 2020, 4:40:56 PM1/10/20
to opencog
On Fri, Jan 10, 2020 at 7:58 AM Alexander Gabriel <goo...@4d6.de> wrote:

When I try to do that with rules defined in scheme like this:

MemberLink(DefinedSchemaNode("bc-deduction-rule-name"), rbs)


There's a typo in the above. It should be " bc-deduction-rule" not "bc-deduction-rule-name". Which is why you get the error below.

the error I get during backward chaining is:

Traceback (most recent call last):
  File "bdi/inference_test.py", line 380, in <module>
    query)
  File "opencog/backwardchainer.pyx", line 35, in opencog.ure.BackwardChainer.__cinit__ (/home/rasberry/git/ure/build/opencog/cython/opencog/ure.cpp:1993)
RuntimeError: Cannot find defined hypergraph for atom (DefinedSchemaNode "bc-deduction-rule-name") ; [1114839971276947956][1]
 (/home/rasberry/git/atomspace/opencog/atoms/core/UniqueLink.cc:125)


--linas

Matt Ikle

unread,
Jan 10, 2020, 4:56:31 PM1/10/20
to ope...@googlegroups.com
Linas,

What you just described makes sense then. Certainly does look like a valid rule. I am not in the context of this particular problem and the rule made sense just not what I expected.

—Matt

Sent from my iPhone

On Jan 10, 2020, at 2:37 PM, Linas Vepstas <linasv...@gmail.com> wrote:



Alexander Gabriel

unread,
Jan 10, 2020, 5:15:07 PM1/10/20
to opencog
Hi Linas,
 
First Alex: As Nil already noted, the results you posted look reasonable, except that the truth value was insane, given the code snippets you posted. I see two possibilities:
-- in addition to running your rule, some other rules are running, and generating a different TV. Maybe some other rules you created and forgot to delete? Maybe some other rules in PLN?
-- there is a bug in python, causing a bogus TV to be set. Seems unlikely but always possible.
 
I dug a bit deeper into the truth value problem, by running a series of queries with all inference rules (both pln and mine) disabled, for a case where there should be no need for inference (picker and robot are on adjacent waypoints and those are predefined as linked).

Query: (StateLink   (ConceptNode "Robot01")  (VariableNode "origin"))

Result (SetLink   (StateLink     (ConceptNode "Robot01")    (ConceptNode "WayPoint001")  ))
Truth: (stv 1.000000 1.000000)



Query: (StateLink   (ConceptNode "Picker01")  (VariableNode "destination"))

Result (SetLink   (StateLink     (ConceptNode "Picker01")    (ConceptNode "WayPoint002")  ))
Truth: (stv 1.000000 1.000000)



Query: (StateLink   (ListLink     (VariableNode "picker")    (PredicateNode "seen_picking")  )  (ConceptNode "FALSE"))

Result (SetLink   (StateLink     (ListLink       (ConceptNode "Picker01")      (PredicateNode "seen_picking")    )    (ConceptNode "FALSE")  ))
Truth: (stv 1.000000 1.000000)



Query: (StateLink   (ListLink     (VariableNode "picker")    (PredicateNode "has_crate")  )  (ConceptNode "FALSE"))

Result (SetLink   (StateLink     (ListLink       (ConceptNode "Picker01")      (PredicateNode "has_crate")    )    (ConceptNode "FALSE")  ))
Truth: (stv 1.000000 1.000000)



Query: (EvaluationLink   (PredicateNode "linked")  (ListLink     (ConceptNode "WayPoint001")    (ConceptNode "WayPoint002")  ))

Result (SetLink   (EvaluationLink     (PredicateNode "linked")    (ListLink       (ConceptNode "WayPoint001")      (ConceptNode "WayPoint002")    )  ))
Truth: (stv 1.000000 1.000000)



Query: (AndLink   (EvaluationLink     (PredicateNode "linked")    (ListLink       (VariableNode "origin")      (VariableNode "destination")    )  )  (StateLink     (ListLink       (VariableNode "picker")      (PredicateNode "has_crate")    )    (ConceptNode "FALSE")  )  (StateLink     (ListLink       (VariableNode "picker")      (PredicateNode "seen_picking")    )    (ConceptNode "FALSE")  )  (StateLink     (ConceptNode "Robot01")    (VariableNode "origin")  )  (StateLink     (ConceptNode "Picker01")    (VariableNode "destination")  ))

Result (SetLink   (AndLink     (StateLink       (ConceptNode "Robot01")      (ConceptNode "WayPoint001")    )    (StateLink       (ListLink         (ConceptNode "Picker01")        (PredicateNode "seen_picking")      )      (ConceptNode "FALSE")    )    (StateLink       (ConceptNode "Picker01")      (ConceptNode "WayPoint002")    )    (EvaluationLink       (PredicateNode "linked")      (ListLink         (ConceptNode "WayPoint001")        (ConceptNode "WayPoint002")      )    )    (StateLink       (ListLink         (ConceptNode "Picker01")        (PredicateNode "has_crate")      )      (ConceptNode "FALSE")    )  ))
Truth: (stv 1.000000 0.000000)


the only query not returning the expected truth value is the last one, which consists of an AndLink, linking the previous ones (with on little difference: it uses VariableNodes instead of ConceptNodes within the EvaluationLink). An AndLink omitting that EvaluationLink also returns the expected 1,1 truth value.
Maybe my error lies in how I use the EvaluationLink?

Best regards,
Alex

Linas Vepstas

unread,
Jan 10, 2020, 5:44:45 PM1/10/20
to opencog
I'm not sure what to make of the email below. By "query", do you mean "run cog-execute! on a BindLink"?  if so, then you are only running the pattern matcher, and not the URE. The pattern matcher never sets or changes truth values, so you describe an impossible situation.

So, I guess you are running the URE/PLN, then?! Which implies that some rule somewhere got in there and altered the TV.  I don't know of any particular way of finding out who touched it.  Is there a way to get a list of the rules that got triggered?

--linas

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.

Alexander Gabriel

unread,
Jan 10, 2020, 5:50:32 PM1/10/20
to opencog


Am Freitag, 10. Januar 2020 22:44:45 UTC schrieb linas:
I'm not sure what to make of the email below. By "query", do you mean "run cog-execute! on a BindLink"?  

I'm running this:

    queries = []

        # WARN: if I add this to the queries it adds the links to the atomspace (as it should I guess)
        # and proceeds to return the results for the just added links, truth values differ over distances


        queries.append(StateLink(
            ConceptNode(config.robot_name),
            VariableNode("origin")))

        queries.append(StateLink(
            ConceptNode(config.picker_name),
            VariableNode("destination")))

        queries.append(StateLink(
            ListLink(VariableNode("picker"), PredicateNode("seen_picking")),
            ConceptNode("FALSE")))

        queries.append(StateLink(
            ListLink(VariableNode("picker"), PredicateNode("has_crate")),
            ConceptNode("FALSE")))

        queries.append(
            EvaluationLink(
                PredicateNode("linked"),
                ListLink(
                    ConceptNode("WayPoint{:03d}".format(config.robot_pos)),
                    ConceptNode("WayPoint{:03d}".format(config.picker_pos)))))


        # this returns results only for predefined links, but even there the truth value has zero confidence
        queries.append(
                AndLink(
                    StateLink(
                        ConceptNode(config.robot_name),
                        VariableNode("origin")),
                    StateLink(
                        ConceptNode(config.picker_name),
                        VariableNode("destination")),
                    StateLink(
                        ListLink(VariableNode("picker"), PredicateNode("seen_picking")),
                        ConceptNode("FALSE")),
                    StateLink(
                        ListLink(VariableNode("picker"), PredicateNode("has_crate")),
                        ConceptNode("FALSE")),
                    EvaluationLink(
                        PredicateNode("linked"),
                        ListLink(
                            VariableNode("origin"),
                            VariableNode("destination")))))

        for query in queries:
            print("Query: {:}\n".format(query))
            chainer = BackwardChainer(atomspace,
                              rbs,
                              query)
            chainer.do_chain()
            results = chainer.get_results()
            print("Result {:}".format(results))
            try:
                print("Truth: {:}".format(results.get_out()[0].tv))
            except:
                pass
            print("\n\n")

here is a link to the rest of the code which defines the contents of the atomspace.

Linas Vepstas

unread,
Jan 10, 2020, 5:53:06 PM1/10/20
to opencog
Yeah, beats me. I don't know how the chainer works. Nil will know more. --linas

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.

Nil Geisweiller

unread,
Jan 13, 2020, 1:23:15 AM1/13/20
to ope...@googlegroups.com
Alex,

On 1/10/20 3:58 PM, Alexander Gabriel wrote:
> InheritanceLink(
>         rbs,
> ConceptNode("URE"))

so you know, as of today, you don't need to create this inheritance
link, it's not used anywhere. Where (in which doc or example) did you
find it? So I can remove or add a note about it, thanks.

Nil

Nil Geisweiller

unread,
Jan 13, 2020, 1:35:48 AM1/13/20
to ope...@googlegroups.com
On 1/10/20 3:33 PM, Alexander Gabriel wrote:
> It doesn't look like I can add the variables using an optional argument:

It would be strange if such argument hasn't been ported. Any idea about
that Vitaly (or someone else)?

> I have no idea what the trace_as and control_as are used for.

You can provide an atomspace, trace_as, to save the trace of the
reasoning process, that are all attempts, failed and successful to reach
the target. This data can then be used to learn control rules to speed
up reasoning next time you perform inference in a similar domain. Such
control rules may be stored on a separate control atomspace.

BTW, the same atomspace can be used for rules, knowledge base, trace and
control, but it may be more convenient to use separate atomspaces.

See

https://github.com/opencog/pln/tree/master/examples/pln/inference-control-learning

for an example of such inference control meta-learning (it crashes BTW,
I'm fixing it right now).

Nil

>
>
> --
> You received this message because you are subscribed to the Google
> Groups "opencog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/bae9200b-697b-4235-a57c-12322bcc29bc%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/bae9200b-697b-4235-a57c-12322bcc29bc%40googlegroups.com?utm_medium=email&utm_source=footer>.

Nil Geisweiller

unread,
Jan 13, 2020, 1:46:06 AM1/13/20
to ope...@googlegroups.com
Hi Alex, Vitaly,

Alex, please set the level of the ure logger to debug and attach the log
file here.

Vitaly, please tell Alex how to set the ure logger level if he doesn't
know how. Also how can we find documentation about the Python API of the
URE (I probably should learn it as well)?

Thanks,
Nil
> <https://gist.github.com/alexander-gabriel/59f06eb3d0f2ffa02b161f9dbca1a12c> which
> defines the contents of the atomspace.
>
> --
> You received this message because you are subscribed to the Google
> Groups "opencog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/7f1d2406-3902-4677-bf35-ebea7d64a0e8%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/7f1d2406-3902-4677-bf35-ebea7d64a0e8%40googlegroups.com?utm_medium=email&utm_source=footer>.

Vitaly Bogdanov

unread,
Jan 13, 2020, 4:07:48 AM1/13/20
to opencog

>> It doesn't look like I can add the variables using an optional argument:
>
>It would be strange if such argument hasn't been ported. Any idea about
>that Vitaly (or someone else)?

Yes it is ported, the name of the parameter is `vardecl`. I believe the following should work:
```
            variables = VariableList(VariableNode("origin"), VariableNode("destination"))
            chainer = BackwardChainer(atomspace, rbs, query, vardecl=variables)
```

>Vitaly, please tell Alex how to set the ure logger level if he doesn't
>know how.

URE logger is not ported into Python API, the simplest way to set its level I know is:
```
    scheme_eval(atomspace, '(use-modules (opencog logger) (opencog ure))')
    scheme_eval(atomspace, '(cog-logger-set-level! (cog-ure-logger) "DEBUG")')
```

>Also how can we find documentation about the Python API of the
>URE (I probably should learn it as well)?

There is no specific about Python API for URE it copies C++ API as far as I know.
There is an example on Python OpenCog API wiki: https://wiki.opencog.org/w/Python#Backward_Chainer

Best regards,
  Vitaly

Alexander Gabriel

unread,
Jan 13, 2020, 12:10:14 PM1/13/20
to opencog
I'll get back to you if I see it in actual opencog code.

Alexander Gabriel

unread,
Jan 13, 2020, 1:03:22 PM1/13/20
to opencog
Hi Nil,


Am Montag, 13. Januar 2020 06:46:06 UTC schrieb Nil:
Hi Alex, Vitaly,

Alex, please set the level of the ure logger to debug and attach the log
file here.

I set the debug level as indicated by Vitaly, but the only output in the opencog.log is this :
[2020-01-13 17:58:15:775] [INFO] [global_python_initialize] Start
[2020-01-13 17:58:15:775] [INFO] [global_python_initialize] Adding OpenCog sys.path directories
[2020-01-13 17:58:15:775] [INFO] [global_python_initialize] Finish
[2020-01-13 17:58:15:775] [INFO] PythonEval::initialize_python_objects_and_imports Finished initialising python evaluator.


 I added a trace atomspace and the content of that is this (with a bit of other output before and after it) after running the backward chainer on the given query:
Robot position: 1
Picker position: 2

Query: (AndLink   (EvaluationLink     (PredicateNode "linked")    (ListLink       (VariableNode "origin")      (VariableNode "destination")    )  )  (StateLink     (ListLink       (VariableNode "picker")      (PredicateNode "has_crate")    )    (ConceptNode "FALSE")  )  (StateLink     (ListLink       (VariableNode "picker")      (PredicateNode "seen_picking")    )    (ConceptNode "FALSE")  )  (StateLink     (ConceptNode "Robot01")    (VariableNode "origin")  )  (StateLink     (ConceptNode "Picker01")    (VariableNode "destination")  ))

[(ConceptNode "WayPoint002" (stv 1.000000 1.000000)) ; [1421707021219169969][4]
, (ConceptNode "FALSE") ; [8059389032376030371][4]
, (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
, (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
, (ConceptNode "WayPoint001" (stv 1.000000 1.000000)) ; [1461315689995762073][4]
, (PredicateNode "seen_picking") ; [4980394588905344669][4]
, (PredicateNode "URE:BC:and-BIT") ; [7937878864955488923][4]
, (PredicateNode "URE:BC:proof-of") ; [7861690586484479273][4]
, (PredicateNode "has_crate") ; [2386365538716170588][4]
, (PredicateNode "URE:BC:target") ; [3655466572582412298][4]
, (PredicateNode "linked") ; [7377131820250567544][4]
, (ListLink
  (DontExecLink
    (BindLink
      (VariableList
        (VariableNode "picker") ; [3320396016748559776][4]
        (VariableNode "origin") ; [1432856408906525938][4]
        (VariableNode "destination") ; [8732522677762917232][4]
      ) ; [12560458022798011237][4]
      (AndLink
        (EvaluationLink
          (PredicateNode "linked") ; [7377131820250567544][4]
          (ListLink
            (VariableNode "origin") ; [1432856408906525938][4]
            (VariableNode "destination") ; [8732522677762917232][4]
          ) ; [16211263182419955128][4]
        ) ; [11737869013450940133][4]
        (StateLink
          (ListLink
            (VariableNode "picker") ; [3320396016748559776][4]
            (PredicateNode "has_crate") ; [2386365538716170588][4]
          ) ; [14008516234445170105][4]
          (ConceptNode "FALSE") ; [8059389032376030371][4]
        ) ; [14480148654898681519][4]
        (StateLink
          (ListLink
            (VariableNode "picker") ; [3320396016748559776][4]
            (PredicateNode "seen_picking") ; [4980394588905344669][4]
          ) ; [13783631960832222081][4]
          (ConceptNode "FALSE") ; [8059389032376030371][4]
        ) ; [15741508350878763237][4]
        (StateLink
          (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
          (VariableNode "origin") ; [1432856408906525938][4]
        ) ; [16982141063225259837][4]
        (StateLink
          (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
          (VariableNode "destination") ; [8732522677762917232][4]
        ) ; [18172667735726832559][4]
      ) ; [10202968835893361781][4]
      (AndLink
        (EvaluationLink
          (PredicateNode "linked") ; [7377131820250567544][4]
          (ListLink
            (VariableNode "origin") ; [1432856408906525938][4]
            (VariableNode "destination") ; [8732522677762917232][4]
          ) ; [16211263182419955128][4]
        ) ; [11737869013450940133][4]
        (StateLink
          (ListLink
            (VariableNode "picker") ; [3320396016748559776][4]
            (PredicateNode "has_crate") ; [2386365538716170588][4]
          ) ; [14008516234445170105][4]
          (ConceptNode "FALSE") ; [8059389032376030371][4]
        ) ; [14480148654898681519][4]
        (StateLink
          (ListLink
            (VariableNode "picker") ; [3320396016748559776][4]
            (PredicateNode "seen_picking") ; [4980394588905344669][4]
          ) ; [13783631960832222081][4]
          (ConceptNode "FALSE") ; [8059389032376030371][4]
        ) ; [15741508350878763237][4]
        (StateLink
          (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
          (VariableNode "origin") ; [1432856408906525938][4]
        ) ; [16982141063225259837][4]
        (StateLink
          (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
          (VariableNode "destination") ; [8732522677762917232][4]
        ) ; [18172667735726832559][4]
      ) ; [10202968835893361781][4]
    ) ; [10378290140134742943][4]
  ) ; [10056885220319300478][4]
  (AndLink
    (StateLink (stv 1.000000 1.000000)
      (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
      (ConceptNode "WayPoint001" (stv 1.000000 1.000000)) ; [1461315689995762073][4]
    ) ; [10246810040960724207][4]
    (StateLink (stv 1.000000 1.000000)
      (ListLink
        (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
        (PredicateNode "seen_picking") ; [4980394588905344669][4]
      ) ; [13553464137728764687][4]
      (ConceptNode "FALSE") ; [8059389032376030371][4]
    ) ; [10800256415231817922][4]
    (StateLink (stv 1.000000 1.000000)
      (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
      (ConceptNode "WayPoint002" (stv 1.000000 1.000000)) ; [1421707021219169969][4]
    ) ; [12979417854504668522][4]
    (EvaluationLink (stv 1.000000 1.000000)
      (PredicateNode "linked") ; [7377131820250567544][4]
      (ListLink
        (ConceptNode "WayPoint001" (stv 1.000000 1.000000)) ; [1461315689995762073][4]
        (ConceptNode "WayPoint002" (stv 1.000000 1.000000)) ; [1421707021219169969][4]
      ) ; [12650955823366188636][4]
    ) ; [13021153103939626777][4]
    (StateLink (stv 1.000000 1.000000)
      (ListLink
        (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
        (PredicateNode "has_crate") ; [2386365538716170588][4]
      ) ; [16000349526672526752][4]
      (ConceptNode "FALSE") ; [8059389032376030371][4]
    ) ; [13021724614411824842][4]
  ) ; [11420344547789796517][4]
) ; [13191677814610597869][4]
, (ListLink
  (VariableNode "origin") ; [1432856408906525938][4]
  (VariableNode "destination") ; [8732522677762917232][4]
) ; [16211263182419955128][4]
, (ListLink
  (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
  (PredicateNode "has_crate") ; [2386365538716170588][4]
) ; [16000349526672526752][4]
, (ListLink
  (ConceptNode "WayPoint001" (stv 1.000000 1.000000)) ; [1461315689995762073][4]
  (ConceptNode "WayPoint002" (stv 1.000000 1.000000)) ; [1421707021219169969][4]
) ; [12650955823366188636][4]
, (ListLink
  (VariableNode "picker") ; [3320396016748559776][4]
  (PredicateNode "has_crate") ; [2386365538716170588][4]
) ; [14008516234445170105][4]
, (ListLink
  (VariableNode "picker") ; [3320396016748559776][4]
  (PredicateNode "seen_picking") ; [4980394588905344669][4]
) ; [13783631960832222081][4]
, (ListLink
  (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
  (PredicateNode "seen_picking") ; [4980394588905344669][4]
) ; [13553464137728764687][4]
, (AndLink
  (StateLink (stv 1.000000 1.000000)
    (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
    (ConceptNode "WayPoint001" (stv 1.000000 1.000000)) ; [1461315689995762073][4]
  ) ; [10246810040960724207][4]
  (StateLink (stv 1.000000 1.000000)
    (ListLink
      (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
      (PredicateNode "seen_picking") ; [4980394588905344669][4]
    ) ; [13553464137728764687][4]
    (ConceptNode "FALSE") ; [8059389032376030371][4]
  ) ; [10800256415231817922][4]
  (StateLink (stv 1.000000 1.000000)
    (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
    (ConceptNode "WayPoint002" (stv 1.000000 1.000000)) ; [1421707021219169969][4]
  ) ; [12979417854504668522][4]
  (EvaluationLink (stv 1.000000 1.000000)
    (PredicateNode "linked") ; [7377131820250567544][4]
    (ListLink
      (ConceptNode "WayPoint001" (stv 1.000000 1.000000)) ; [1461315689995762073][4]
      (ConceptNode "WayPoint002" (stv 1.000000 1.000000)) ; [1421707021219169969][4]
    ) ; [12650955823366188636][4]
  ) ; [13021153103939626777][4]
  (StateLink (stv 1.000000 1.000000)
    (ListLink
      (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
      (PredicateNode "has_crate") ; [2386365538716170588][4]
    ) ; [16000349526672526752][4]
    (ConceptNode "FALSE") ; [8059389032376030371][4]
  ) ; [13021724614411824842][4]
) ; [11420344547789796517][4]
, (AndLink
  (EvaluationLink
    (PredicateNode "linked") ; [7377131820250567544][4]
    (ListLink
      (VariableNode "origin") ; [1432856408906525938][4]
      (VariableNode "destination") ; [8732522677762917232][4]
    ) ; [16211263182419955128][4]
  ) ; [11737869013450940133][4]
  (StateLink
    (ListLink
      (VariableNode "picker") ; [3320396016748559776][4]
      (PredicateNode "has_crate") ; [2386365538716170588][4]
    ) ; [14008516234445170105][4]
    (ConceptNode "FALSE") ; [8059389032376030371][4]
  ) ; [14480148654898681519][4]
  (StateLink
    (ListLink
      (VariableNode "picker") ; [3320396016748559776][4]
      (PredicateNode "seen_picking") ; [4980394588905344669][4]
    ) ; [13783631960832222081][4]
    (ConceptNode "FALSE") ; [8059389032376030371][4]
  ) ; [15741508350878763237][4]
  (StateLink
    (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
    (VariableNode "origin") ; [1432856408906525938][4]
  ) ; [16982141063225259837][4]
  (StateLink
    (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
    (VariableNode "destination") ; [8732522677762917232][4]
  ) ; [18172667735726832559][4]
) ; [10202968835893361781][4]
, (VariableNode "picker") ; [3320396016748559776][4]
, (VariableNode "destination") ; [8732522677762917232][4]
, (VariableNode "origin") ; [1432856408906525938][4]
, (VariableList
  (VariableNode "picker") ; [3320396016748559776][4]
  (VariableNode "origin") ; [1432856408906525938][4]
  (VariableNode "destination") ; [8732522677762917232][4]
) ; [12560458022798011237][4]
, (DontExecLink
  (BindLink
    (VariableList
      (VariableNode "picker") ; [3320396016748559776][4]
      (VariableNode "origin") ; [1432856408906525938][4]
      (VariableNode "destination") ; [8732522677762917232][4]
    ) ; [12560458022798011237][4]
    (AndLink
      (EvaluationLink
        (PredicateNode "linked") ; [7377131820250567544][4]
        (ListLink
          (VariableNode "origin") ; [1432856408906525938][4]
          (VariableNode "destination") ; [8732522677762917232][4]
        ) ; [16211263182419955128][4]
      ) ; [11737869013450940133][4]
      (StateLink
        (ListLink
          (VariableNode "picker") ; [3320396016748559776][4]
          (PredicateNode "has_crate") ; [2386365538716170588][4]
        ) ; [14008516234445170105][4]
        (ConceptNode "FALSE") ; [8059389032376030371][4]
      ) ; [14480148654898681519][4]
      (StateLink
        (ListLink
          (VariableNode "picker") ; [3320396016748559776][4]
          (PredicateNode "seen_picking") ; [4980394588905344669][4]
        ) ; [13783631960832222081][4]
        (ConceptNode "FALSE") ; [8059389032376030371][4]
      ) ; [15741508350878763237][4]
      (StateLink
        (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
        (VariableNode "origin") ; [1432856408906525938][4]
      ) ; [16982141063225259837][4]
      (StateLink
        (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
        (VariableNode "destination") ; [8732522677762917232][4]
      ) ; [18172667735726832559][4]
    ) ; [10202968835893361781][4]
    (AndLink
      (EvaluationLink
        (PredicateNode "linked") ; [7377131820250567544][4]
        (ListLink
          (VariableNode "origin") ; [1432856408906525938][4]
          (VariableNode "destination") ; [8732522677762917232][4]
        ) ; [16211263182419955128][4]
      ) ; [11737869013450940133][4]
      (StateLink
        (ListLink
          (VariableNode "picker") ; [3320396016748559776][4]
          (PredicateNode "has_crate") ; [2386365538716170588][4]
        ) ; [14008516234445170105][4]
        (ConceptNode "FALSE") ; [8059389032376030371][4]
      ) ; [14480148654898681519][4]
      (StateLink
        (ListLink
          (VariableNode "picker") ; [3320396016748559776][4]
          (PredicateNode "seen_picking") ; [4980394588905344669][4]
        ) ; [13783631960832222081][4]
        (ConceptNode "FALSE") ; [8059389032376030371][4]
      ) ; [15741508350878763237][4]
      (StateLink
        (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
        (VariableNode "origin") ; [1432856408906525938][4]
      ) ; [16982141063225259837][4]
      (StateLink
        (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
        (VariableNode "destination") ; [8732522677762917232][4]
      ) ; [18172667735726832559][4]
    ) ; [10202968835893361781][4]
  ) ; [10378290140134742943][4]
) ; [10056885220319300478][4]
, (StateLink (stv 1.000000 1.000000)
  (ListLink
    (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
    (PredicateNode "has_crate") ; [2386365538716170588][4]
  ) ; [16000349526672526752][4]
  (ConceptNode "FALSE") ; [8059389032376030371][4]
) ; [13021724614411824842][4]
, (StateLink (stv 1.000000 1.000000)
  (ListLink
    (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
    (PredicateNode "seen_picking") ; [4980394588905344669][4]
  ) ; [13553464137728764687][4]
  (ConceptNode "FALSE") ; [8059389032376030371][4]
) ; [10800256415231817922][4]
, (StateLink (stv 1.000000 1.000000)
  (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
  (ConceptNode "WayPoint001" (stv 1.000000 1.000000)) ; [1461315689995762073][4]
) ; [10246810040960724207][4]
, (StateLink
  (ListLink
    (VariableNode "picker") ; [3320396016748559776][4]
    (PredicateNode "has_crate") ; [2386365538716170588][4]
  ) ; [14008516234445170105][4]
  (ConceptNode "FALSE") ; [8059389032376030371][4]
) ; [14480148654898681519][4]
, (StateLink (stv 1.000000 1.000000)
  (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
  (ConceptNode "WayPoint002" (stv 1.000000 1.000000)) ; [1421707021219169969][4]
) ; [12979417854504668522][4]
, (StateLink
  (ListLink
    (VariableNode "picker") ; [3320396016748559776][4]
    (PredicateNode "seen_picking") ; [4980394588905344669][4]
  ) ; [13783631960832222081][4]
  (ConceptNode "FALSE") ; [8059389032376030371][4]
) ; [15741508350878763237][4]
, (StateLink
  (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
  (VariableNode "origin") ; [1432856408906525938][4]
) ; [16982141063225259837][4]
, (StateLink
  (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
  (VariableNode "destination") ; [8732522677762917232][4]
) ; [18172667735726832559][4]
, (BindLink
  (VariableList
    (VariableNode "picker") ; [3320396016748559776][4]
    (VariableNode "origin") ; [1432856408906525938][4]
    (VariableNode "destination") ; [8732522677762917232][4]
  ) ; [12560458022798011237][4]
  (AndLink
    (EvaluationLink
      (PredicateNode "linked") ; [7377131820250567544][4]
      (ListLink
        (VariableNode "origin") ; [1432856408906525938][4]
        (VariableNode "destination") ; [8732522677762917232][4]
      ) ; [16211263182419955128][4]
    ) ; [11737869013450940133][4]
    (StateLink
      (ListLink
        (VariableNode "picker") ; [3320396016748559776][4]
        (PredicateNode "has_crate") ; [2386365538716170588][4]
      ) ; [14008516234445170105][4]
      (ConceptNode "FALSE") ; [8059389032376030371][4]
    ) ; [14480148654898681519][4]
    (StateLink
      (ListLink
        (VariableNode "picker") ; [3320396016748559776][4]
        (PredicateNode "seen_picking") ; [4980394588905344669][4]
      ) ; [13783631960832222081][4]
      (ConceptNode "FALSE") ; [8059389032376030371][4]
    ) ; [15741508350878763237][4]
    (StateLink
      (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
      (VariableNode "origin") ; [1432856408906525938][4]
    ) ; [16982141063225259837][4]
    (StateLink
      (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
      (VariableNode "destination") ; [8732522677762917232][4]
    ) ; [18172667735726832559][4]
  ) ; [10202968835893361781][4]
  (AndLink
    (EvaluationLink
      (PredicateNode "linked") ; [7377131820250567544][4]
      (ListLink
        (VariableNode "origin") ; [1432856408906525938][4]
        (VariableNode "destination") ; [8732522677762917232][4]
      ) ; [16211263182419955128][4]
    ) ; [11737869013450940133][4]
    (StateLink
      (ListLink
        (VariableNode "picker") ; [3320396016748559776][4]
        (PredicateNode "has_crate") ; [2386365538716170588][4]
      ) ; [14008516234445170105][4]
      (ConceptNode "FALSE") ; [8059389032376030371][4]
    ) ; [14480148654898681519][4]
    (StateLink
      (ListLink
        (VariableNode "picker") ; [3320396016748559776][4]
        (PredicateNode "seen_picking") ; [4980394588905344669][4]
      ) ; [13783631960832222081][4]
      (ConceptNode "FALSE") ; [8059389032376030371][4]
    ) ; [15741508350878763237][4]
    (StateLink
      (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
      (VariableNode "origin") ; [1432856408906525938][4]
    ) ; [16982141063225259837][4]
    (StateLink
      (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
      (VariableNode "destination") ; [8732522677762917232][4]
    ) ; [18172667735726832559][4]
  ) ; [10202968835893361781][4]
) ; [10378290140134742943][4]
, (EvaluationLink
  (PredicateNode "URE:BC:proof-of") ; [7861690586484479273][4]
  (ListLink
    (DontExecLink
      (BindLink
        (VariableList
          (VariableNode "picker") ; [3320396016748559776][4]
          (VariableNode "origin") ; [1432856408906525938][4]
          (VariableNode "destination") ; [8732522677762917232][4]
        ) ; [12560458022798011237][4]
        (AndLink
          (EvaluationLink
            (PredicateNode "linked") ; [7377131820250567544][4]
            (ListLink
              (VariableNode "origin") ; [1432856408906525938][4]
              (VariableNode "destination") ; [8732522677762917232][4]
            ) ; [16211263182419955128][4]
          ) ; [11737869013450940133][4]
          (StateLink
            (ListLink
              (VariableNode "picker") ; [3320396016748559776][4]
              (PredicateNode "has_crate") ; [2386365538716170588][4]
            ) ; [14008516234445170105][4]
            (ConceptNode "FALSE") ; [8059389032376030371][4]
          ) ; [14480148654898681519][4]
          (StateLink
            (ListLink
              (VariableNode "picker") ; [3320396016748559776][4]
              (PredicateNode "seen_picking") ; [4980394588905344669][4]
            ) ; [13783631960832222081][4]
            (ConceptNode "FALSE") ; [8059389032376030371][4]
          ) ; [15741508350878763237][4]
          (StateLink
            (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
            (VariableNode "origin") ; [1432856408906525938][4]
          ) ; [16982141063225259837][4]
          (StateLink
            (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
            (VariableNode "destination") ; [8732522677762917232][4]
          ) ; [18172667735726832559][4]
        ) ; [10202968835893361781][4]
        (AndLink
          (EvaluationLink
            (PredicateNode "linked") ; [7377131820250567544][4]
            (ListLink
              (VariableNode "origin") ; [1432856408906525938][4]
              (VariableNode "destination") ; [8732522677762917232][4]
            ) ; [16211263182419955128][4]
          ) ; [11737869013450940133][4]
          (StateLink
            (ListLink
              (VariableNode "picker") ; [3320396016748559776][4]
              (PredicateNode "has_crate") ; [2386365538716170588][4]
            ) ; [14008516234445170105][4]
            (ConceptNode "FALSE") ; [8059389032376030371][4]
          ) ; [14480148654898681519][4]
          (StateLink
            (ListLink
              (VariableNode "picker") ; [3320396016748559776][4]
              (PredicateNode "seen_picking") ; [4980394588905344669][4]
            ) ; [13783631960832222081][4]
            (ConceptNode "FALSE") ; [8059389032376030371][4]
          ) ; [15741508350878763237][4]
          (StateLink
            (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
            (VariableNode "origin") ; [1432856408906525938][4]
          ) ; [16982141063225259837][4]
          (StateLink
            (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
            (VariableNode "destination") ; [8732522677762917232][4]
          ) ; [18172667735726832559][4]
        ) ; [10202968835893361781][4]
      ) ; [10378290140134742943][4]
    ) ; [10056885220319300478][4]
    (AndLink
      (StateLink (stv 1.000000 1.000000)
        (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
        (ConceptNode "WayPoint001" (stv 1.000000 1.000000)) ; [1461315689995762073][4]
      ) ; [10246810040960724207][4]
      (StateLink (stv 1.000000 1.000000)
        (ListLink
          (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
          (PredicateNode "seen_picking") ; [4980394588905344669][4]
        ) ; [13553464137728764687][4]
        (ConceptNode "FALSE") ; [8059389032376030371][4]
      ) ; [10800256415231817922][4]
      (StateLink (stv 1.000000 1.000000)
        (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
        (ConceptNode "WayPoint002" (stv 1.000000 1.000000)) ; [1421707021219169969][4]
      ) ; [12979417854504668522][4]
      (EvaluationLink (stv 1.000000 1.000000)
        (PredicateNode "linked") ; [7377131820250567544][4]
        (ListLink
          (ConceptNode "WayPoint001" (stv 1.000000 1.000000)) ; [1461315689995762073][4]
          (ConceptNode "WayPoint002" (stv 1.000000 1.000000)) ; [1421707021219169969][4]
        ) ; [12650955823366188636][4]
      ) ; [13021153103939626777][4]
      (StateLink (stv 1.000000 1.000000)
        (ListLink
          (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
          (PredicateNode "has_crate") ; [2386365538716170588][4]
        ) ; [16000349526672526752][4]
        (ConceptNode "FALSE") ; [8059389032376030371][4]
      ) ; [13021724614411824842][4]
    ) ; [11420344547789796517][4]
  ) ; [13191677814610597869][4]
) ; [12250320817453029415][4]
, (EvaluationLink (stv 1.000000 1.000000)
  (PredicateNode "linked") ; [7377131820250567544][4]
  (ListLink
    (ConceptNode "WayPoint001" (stv 1.000000 1.000000)) ; [1461315689995762073][4]
    (ConceptNode "WayPoint002" (stv 1.000000 1.000000)) ; [1421707021219169969][4]
  ) ; [12650955823366188636][4]
) ; [13021153103939626777][4]
, (EvaluationLink (stv 1.000000 1.000000)
  (PredicateNode "URE:BC:target") ; [3655466572582412298][4]
  (AndLink
    (EvaluationLink
      (PredicateNode "linked") ; [7377131820250567544][4]
      (ListLink
        (VariableNode "origin") ; [1432856408906525938][4]
        (VariableNode "destination") ; [8732522677762917232][4]
      ) ; [16211263182419955128][4]
    ) ; [11737869013450940133][4]
    (StateLink
      (ListLink
        (VariableNode "picker") ; [3320396016748559776][4]
        (PredicateNode "has_crate") ; [2386365538716170588][4]
      ) ; [14008516234445170105][4]
      (ConceptNode "FALSE") ; [8059389032376030371][4]
    ) ; [14480148654898681519][4]
    (StateLink
      (ListLink
        (VariableNode "picker") ; [3320396016748559776][4]
        (PredicateNode "seen_picking") ; [4980394588905344669][4]
      ) ; [13783631960832222081][4]
      (ConceptNode "FALSE") ; [8059389032376030371][4]
    ) ; [15741508350878763237][4]
    (StateLink
      (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
      (VariableNode "origin") ; [1432856408906525938][4]
    ) ; [16982141063225259837][4]
    (StateLink
      (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
      (VariableNode "destination") ; [8732522677762917232][4]
    ) ; [18172667735726832559][4]
  ) ; [10202968835893361781][4]
) ; [9437574303461310653][4]
, (EvaluationLink
  (PredicateNode "linked") ; [7377131820250567544][4]
  (ListLink
    (VariableNode "origin") ; [1432856408906525938][4]
    (VariableNode "destination") ; [8732522677762917232][4]
  ) ; [16211263182419955128][4]
) ; [11737869013450940133][4]
, (EvaluationLink (stv 1.000000 1.000000)
  (PredicateNode "URE:BC:and-BIT") ; [7937878864955488923][4]
  (DontExecLink
    (BindLink
      (VariableList
        (VariableNode "picker") ; [3320396016748559776][4]
        (VariableNode "origin") ; [1432856408906525938][4]
        (VariableNode "destination") ; [8732522677762917232][4]
      ) ; [12560458022798011237][4]
      (AndLink
        (EvaluationLink
          (PredicateNode "linked") ; [7377131820250567544][4]
          (ListLink
            (VariableNode "origin") ; [1432856408906525938][4]
            (VariableNode "destination") ; [8732522677762917232][4]
          ) ; [16211263182419955128][4]
        ) ; [11737869013450940133][4]
        (StateLink
          (ListLink
            (VariableNode "picker") ; [3320396016748559776][4]
            (PredicateNode "has_crate") ; [2386365538716170588][4]
          ) ; [14008516234445170105][4]
          (ConceptNode "FALSE") ; [8059389032376030371][4]
        ) ; [14480148654898681519][4]
        (StateLink
          (ListLink
            (VariableNode "picker") ; [3320396016748559776][4]
            (PredicateNode "seen_picking") ; [4980394588905344669][4]
          ) ; [13783631960832222081][4]
          (ConceptNode "FALSE") ; [8059389032376030371][4]
        ) ; [15741508350878763237][4]
        (StateLink
          (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
          (VariableNode "origin") ; [1432856408906525938][4]
        ) ; [16982141063225259837][4]
        (StateLink
          (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
          (VariableNode "destination") ; [8732522677762917232][4]
        ) ; [18172667735726832559][4]
      ) ; [10202968835893361781][4]
      (AndLink
        (EvaluationLink
          (PredicateNode "linked") ; [7377131820250567544][4]
          (ListLink
            (VariableNode "origin") ; [1432856408906525938][4]
            (VariableNode "destination") ; [8732522677762917232][4]
          ) ; [16211263182419955128][4]
        ) ; [11737869013450940133][4]
        (StateLink
          (ListLink
            (VariableNode "picker") ; [3320396016748559776][4]
            (PredicateNode "has_crate") ; [2386365538716170588][4]
          ) ; [14008516234445170105][4]
          (ConceptNode "FALSE") ; [8059389032376030371][4]
        ) ; [14480148654898681519][4]
        (StateLink
          (ListLink
            (VariableNode "picker") ; [3320396016748559776][4]
            (PredicateNode "seen_picking") ; [4980394588905344669][4]
          ) ; [13783631960832222081][4]
          (ConceptNode "FALSE") ; [8059389032376030371][4]
        ) ; [15741508350878763237][4]
        (StateLink
          (ConceptNode "Robot01" (stv 1.000000 1.000000)) ; [8656126396895433734][4]
          (VariableNode "origin") ; [1432856408906525938][4]
        ) ; [16982141063225259837][4]
        (StateLink
          (ConceptNode "Picker01" (stv 1.000000 1.000000)) ; [5250680523874337442][4]
          (VariableNode "destination") ; [8732522677762917232][4]
        ) ; [18172667735726832559][4]
      ) ; [10202968835893361781][4]
    ) ; [10378290140134742943][4]
  ) ; [10056885220319300478][4]
) ; [9756272752300218847][4]
, (SchemaNode "URE:BC:expand-and-BIT") ; [9124129740472279502][4]
]
Result (SetLink   (AndLink     (StateLink       (ConceptNode "Robot01")      (ConceptNode "WayPoint001")    )    (StateLink       (ListLink         (ConceptNode "Picker01")        (PredicateNode "seen_picking")      )      (ConceptNode "FALSE")    )    (StateLink       (ConceptNode "Picker01")      (ConceptNode "WayPoint002")    )    (EvaluationLink       (PredicateNode "linked")      (ListLink         (ConceptNode "WayPoint001")        (ConceptNode "WayPoint002")      )    )    (StateLink       (ListLink         (ConceptNode "Picker01")        (PredicateNode "has_crate")      )      (ConceptNode "FALSE")    )  ))
Truth: (stv 1.000000 0.000000)


thank you for your help and time!

Best,
Alex

Nil Geisweiller

unread,
Jan 14, 2020, 7:04:35 AM1/14/20
to ope...@googlegroups.com
Hi,

On 1/13/20 8:03 PM, Alexander Gabriel wrote:
> I set the debug level as indicated by Vitaly, but the only output in the
> opencog.log is this :
> |
> [2020-01-13 17:58:15:775] [INFO] [global_python_initialize] Start
> [2020-01-13 17:58:15:775] [INFO] [global_python_initialize] Adding
> OpenCog sys.path directories
> [2020-01-13 17:58:15:775] [INFO] [global_python_initialize] Finish
> [2020-01-13 17:58:15:775] [INFO]
> PythonEval::initialize_python_objects_and_imports Finished initialising
> python evaluator.

That's not normal. Alex, after setting up the log level, what do you get
from calling (in scheme)

(ure-logger-get-level)

?

it's gonna be difficult to debug without debug log. Let's figure that
out first. By default logging is written in a local file

opencog.log

Sure you're looking at that?

Vitaly, any idea?

Nil
> --
> You received this message because you are subscribed to the Google
> Groups "opencog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/7546e8a0-1e49-49e3-b7f9-3dba4a159927%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/7546e8a0-1e49-49e3-b7f9-3dba4a159927%40googlegroups.com?utm_medium=email&utm_source=footer>.

Alexander Gabriel

unread,
Jan 14, 2020, 7:08:02 AM1/14/20
to opencog
Hi!
 
That's not normal. Alex, after setting up the log level, what do you get
from calling (in scheme)

(ure-logger-get-level)

I added that line right after the line where I set the log level as such:
    execute_code = \
    '''
    (use-modules (opencog logger) (opencog ure))
    (load-from-path "/home/rasberry/git/ure/tests/ure/rules/bc-deduction-rule.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/meta-rules/predicate/conditional-full-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/meta-rules/predicate/conditional-partial-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/meta-rules/predicate/universal-full-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/term/deduction.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/propositional/modus-ponens.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/propositional/contraposition.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/implication-scope-to-implication.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/implication-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/negation-introduction.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/not-simplification.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/not-elimination.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/evaluation-to-member.scm")

    (define rbs (Concept "deduction-rule-base"))
    (ure-set-complexity-penalty rbs 0.1)
    (cog-logger-set-level! (cog-ure-logger) "DEBUG")
    (ure-logger-get-level)
    '''
    scheme_eval(atomspace, execute_code)

 but it doesn't produce any output.
That indeed seems strange.

best,
Alex

Nil Geisweiller

unread,
Jan 14, 2020, 7:17:06 AM1/14/20
to ope...@googlegroups.com, Alexander Gabriel
On 1/14/20 2:08 PM, Alexander Gabriel wrote:
>     (cog-logger-set-level! (cog-ure-logger) "DEBUG")

You should BTW be able to use

(ure-logger-set-level! "DEBUG")

as long as the ure scheme module is loaded.

Nil

Alexander Gabriel

unread,
Jan 14, 2020, 7:28:06 AM1/14/20
to opencog
You should BTW be able to use

(ure-logger-set-level! "DEBUG")

as long as the ure scheme module is loaded. 

That works as well as the other line, no error, same minimal log output, no cli output from the get command.

Linas Vepstas

unread,
Jan 14, 2020, 10:12:35 AM1/14/20
to opencog
Sanity check -- do you have the latest cogutils and the latest atomspace?  Are you sure you installed to the same location (e.g. you don't have a second conflicting cogutils/atomspace in /opt vs /usr/local ?) Are you using the opencog-github versions instead of the singularity-net versions?

-- linas

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/80b4f6ee-471c-48d2-936b-81578d38e892%40googlegroups.com.

Alexander Gabriel

unread,
Jan 14, 2020, 10:20:41 AM1/14/20
to opencog
Hi Linas,


Am Dienstag, 14. Januar 2020 15:12:35 UTC schrieb linas:
Sanity check -- do you have the latest cogutils and the latest atomspace?  Are you sure you installed to the same location (e.g. you don't have a second conflicting cogutils/atomspace in /opt vs /usr/local ?) Are you using the opencog-github versions instead of the singularity-net versions? 

I compiled and installed directly from github master HEAD, without python3 because that prohibited me using python2.
Versions are:

opencog:
commit 51ee03ad5107b6b1a4a02e4d343a996b3f010cac
Merge: 5010028 3c21ffb
Author: Nil Geisweiller 
Date:   Mon Nov 25 11:44:03 2019 +0200

ure:
commit 128ae411f2977c3425157b90edfd07bddd3e4b1f
Merge: 02710e6 b23a722
Author: Vitaly Bogdanov 
Date:   Tue Dec 3 14:43:48 2019 +0300

atomspace:
commit 133516fef01f96ac8a8d16857e6a1d92912f5e84
Merge: d774c7c f74692f
Author: Linas Vepštas 
Date:   Tue Nov 26 01:38:58 2019 -0600

cogutil:
commit f3f2c69525b87c7302999a6f182bf491a2aaf0d3
Merge: aa1c0f6 1a41709
Author: Linas Vepštas 
Date:   Thu Nov 21 11:18:53 2019 -0600


I hope that's correct?

best,
Alex

Linas Vepstas

unread,
Jan 14, 2020, 10:49:43 AM1/14/20
to opencog
OK, that seems to be new enough and with self-consistent timestamps, it should work.

Try fiddling with the logger all by itself, at the guile prompt, see if you can make it work. The only issue I can think of would be with regards to the cogserver: the logger works both with and without the cogserver, but if you do start the cogserver, then it re-initializes (hijacks) the logger and sends the output to a different location, where you might not be looking.

Some useful commands:

(use-modules (opencog) (opencog exec))
(use-modules (opencog logger))

; optional formating
(cog-logger-set-stdout! #t)
(cog-logger-set-timestamp! #f)
(cog-logger-set-level! "fine")

(cog-logger-info "this is an info test")
(cog-logger-debug "another test at debug level")
(cog-logger-fine "now fine grained logging")

; then this:
(use-modules (opencog ure))

;  print a list of all logger commands
,apropos logger

; try above with the ure logger:
(ure-logger-get-filename)
(ure-logger-set-stdout! #t)
(ure-logger-info "test message")


--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.

Alexander Gabriel

unread,
Jan 14, 2020, 11:10:55 AM1/14/20
to opencog
(use-modules (opencog) (opencog exec))
(use-modules (opencog logger))

; optional formating
(cog-logger-set-stdout! #t)
(cog-logger-set-timestamp! #f)
(cog-logger-set-level! "fine")

(cog-logger-info "this is an info test")
(cog-logger-debug "another test at debug level")
(cog-logger-fine "now fine grained logging")


I ran this:
    execute_code = \
    '''
    (use-modules (opencog logger) (opencog ure) (opencog exec))
    (load-from-path "/home/rasberry/git/ure/tests/ure/rules/bc-deduction-rule.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/meta-rules/predicate/conditional-full-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/meta-rules/predicate/conditional-partial-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/meta-rules/predicate/universal-full-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/term/deduction.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/propositional/modus-ponens.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/propositional/contraposition.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/implication-scope-to-implication.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/implication-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/negation-introduction.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/not-simplification.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/not-elimination.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/evaluation-to-member.scm")

    (define rbs (Concept "deduction-rule-base"))
    (ure-set-complexity-penalty rbs 0.1)
    (ure-logger-set-level! "DEBUG")
    (cog-logger-set-stdout! #t)
    (cog-logger-set-timestamp! #f)
    (cog-logger-info "this is an info test")
    (cog-logger-debug "another test at debug level")
    (cog-logger-fine "now fine grained logging")
    (ure-logger-get-level)
    '''
    scheme_eval(atomspace, execute_code)

 in my program and it printed the info test to the console. I could find it in opencog.log as well. The debug and fine test outputs I couldn't find.

then I ran this:
    execute_code = \
    '''
    (use-modules (opencog logger) (opencog ure) (opencog exec))
    (load-from-path "/home/rasberry/git/ure/tests/ure/rules/bc-deduction-rule.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/meta-rules/predicate/conditional-full-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/meta-rules/predicate/conditional-partial-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/meta-rules/predicate/universal-full-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/term/deduction.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/propositional/modus-ponens.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/propositional/contraposition.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/implication-scope-to-implication.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/implication-instantiation.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/negation-introduction.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/not-simplification.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/not-elimination.scm")
    (load-from-path "/home/rasberry/git/opencog/opencog/pln/rules/wip/evaluation-to-member.scm")

    (define rbs (Concept "deduction-rule-base"))
    (ure-set-complexity-penalty rbs 0.1)
    (ure-logger-set-level! "DEBUG")
    (cog-logger-set-stdout! #t)
    (cog-logger-set-timestamp! #f)
    (ure-logger-get-filename)
    (ure-logger-set-stdout! #t)
    (ure-logger-info "test message")
    (ure-logger-debug "ure test at debug level")
    (ure-logger-fine "ure fine grained logging")
    (cog-logger-info "this is an info test")
    (cog-logger-debug "another test at debug level")
    (cog-logger-fine "now fine grained logging")
    (ure-logger-get-level)
    '''
    scheme_eval(atomspace, execute_code)

it also sets the ure logger and sends ure test log messages. Now I find both info messages as well as the ure debug message on the console and in the log file.

seems like we're getting closer.

Alexander Gabriel

unread,
Jan 14, 2020, 11:13:51 AM1/14/20
to opencog
and if I set the cog-logger also to debug I find ure and cog debug messages.
I wasn't aware there were different loggers.
What I still don't see are any messages from the actual backward chaining process..

Linas Vepstas

unread,
Jan 14, 2020, 11:56:45 AM1/14/20
to opencog
On Tue, Jan 14, 2020 at 10:13 AM Alexander Gabriel <goo...@4d6.de> wrote:
and if I set the cog-logger also to debug I find ure and cog debug messages.
I wasn't aware there were different loggers.

I'm not sure how they designed the logger code, I think its supposed to just be a flag for tracing a sub-component. 

BTW, in guile, you can get documentation by typing ,d or ,describe for example:

scheme@(guile-user)> ,describe cog-logger-set-stdout!

 cog-logger-set-stdout! [LOGGER] BOOL
    If BOOL is #t, send log messages to stdout; else don't.
    If LOGGER is not provided then use the default logger

    Returns the previous setting.

Unfortunately, not everything has documentation:

scheme@(guile-user)> ,describe ure-logger-set-stdout!
#f

What I still don't see are any messages from the actual backward chaining process..

Don't know.  Nil knows all.

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.

Nil Geisweiller

unread,
Jan 15, 2020, 3:08:36 AM1/15/20
to ope...@googlegroups.com
On 1/14/20 6:56 PM, Linas Vepstas wrote:
>
>
> On Tue, Jan 14, 2020 at 10:13 AM Alexander Gabriel <goo...@4d6.de
> <mailto:goo...@4d6.de>> wrote:
>
> and if I set the cog-logger also to debug I find ure and cog debug
> messages.
> I wasn't aware there were different loggers.
>
>
> I'm not sure how they designed the logger code, I think its supposed to
> just be a flag for tracing a sub-component.

No, they are different loggers, however they are allowed to point to the
same destination. But they can be configured independently, which is
convenient when you want to log different components with different levels.

> BTW, in guile, you can get documentation by typing ,d or ,describe for
> example:
>
> scheme@(guile-user)> ,describe cog-logger-set-stdout!
>
>  cog-logger-set-stdout! [LOGGER] BOOL
>     If BOOL is #t, send log messages to stdout; else don't.
>     If LOGGER is not provided then use the default logger
>
>     Returns the previous setting.
>
> Unfortunately, not everything has documentation:
>
> scheme@(guile-user)> ,describe ure-logger-set-stdout!
> #f
>
> What I still don't see are any messages from the actual backward
> chaining process..
>
>
> Don't know.  Nil knows all.

Nil is an abstraction, and like any abstraction, he loses information
(and didn't write docstrings for these helpers).

Nil

Alexander Gabriel

unread,
Jan 15, 2020, 9:59:47 AM1/15/20
to opencog
Hi all,

I ran another test concerning the interaction between AndLink and EvaluationLink
variables = VariableList(TypedVariableLink(VariableNode("origin"), TypeNode("ConceptNode")), TypedVariableLink(VariableNode("destination"), TypeNode("ConceptNode")))
query = AndLink(EvaluationLink(
                    PredicateNode("linked"),
                    ListLink(
                        VariableNode("origin"),
                        VariableNode("destination"))))

chainer = BackwardChainer(atomspace,
                              ConceptNode("None"),
                              query, vardecl=variables)
chainer.do_chain()

This returns a result with wrong truth values of (1, 0) for all the found EvaluationLinks as well as the AndLink. The same happens when I replace the AndLink with an OrLink.

This is the same query just without the encapsulating AndLink.
variables= VariableList(TypedVariableLink(VariableNode("origin"), TypeNode("ConceptNode")), TypedVariableLink(VariableNode("destination"), TypeNode("ConceptNode")))
query =                 EvaluationLink(
                    PredicateNode("linked"),
                    ListLink(
                        VariableNode("origin"),
                        VariableNode("destination"))))

chainer = BackwardChainer(atomspace,
                              ConceptNode("None"),
                              query, vardecl=variables)
chainer.do_chain()

It returns correct truth values of (1, 1) for every found EvaluationLink.

So there seems to be an error occurring regarding the proper attribution of truth values to EvaluationLinks when the EvaluationLink is encapsulated in some other Link (AndLink, OrLink).
 
best,
Alex

Nil Geisweiller

unread,
Jan 16, 2020, 6:40:44 AM1/16/20
to ope...@googlegroups.com
Hi Alex,

On 1/15/20 4:59 PM, Alexander Gabriel wrote:
> So there seems to be an error occurring regarding the proper attribution
> of truth values to EvaluationLinks when the EvaluationLink is
> encapsulated in some other Link (AndLink, OrLink).

Yes, that's cause you need URE rules to deal with And, Or, Not links as
well. See

https://github.com/opencog/pln/tree/master/opencog/pln/rules/crisp/propositional
https://github.com/opencog/pln/tree/master/opencog/pln/rules/propositional

for examples of such rules.

And see

https://github.com/opencog/pln/tree/master/examples/pln/propositional

for example of their usage.

Nil

> best,
> Alex
>
> --
> You received this message because you are subscribed to the Google
> Groups "opencog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/fe0aaddc-7cdc-4045-9c47-9a1e60e5cd4a%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/fe0aaddc-7cdc-4045-9c47-9a1e60e5cd4a%40googlegroups.com?utm_medium=email&utm_source=footer>.

Alexander Gabriel

unread,
Jan 16, 2020, 8:22:23 AM1/16/20
to opencog
Yes, that's cause you need URE rules to deal with And, Or, Not links as
well. See

https://github.com/opencog/pln/tree/master/opencog/pln/rules/crisp/propositional
https://github.com/opencog/pln/tree/master/opencog/pln/rules/propositional

for examples of such rules.

 
So, from looking at the AndLink, I gather that it can only be applied to EvaluationLinks, InheritanceLinks, OrLinks, NotLinks, and ExecutionLinks. Is there a preferred way of how to apply it (and its brethren) to StateLinks, (and PresentLinks, AlwaysLinks and so on)?

Best,
Alex

Nil Geisweiller

unread,
Jan 16, 2020, 8:52:32 AM1/16/20
to ope...@googlegroups.com
On 1/16/20 3:22 PM, Alexander Gabriel wrote:
> Yes, that's cause you need URE rules to deal with And, Or, Not links as
> well. See
>
> https://github.com/opencog/pln/tree/master/opencog/pln/rules/crisp/propositional
> <https://github.com/opencog/pln/tree/master/opencog/pln/rules/crisp/propositional>
>
> https://github.com/opencog/pln/tree/master/opencog/pln/rules/propositional
> <https://github.com/opencog/pln/tree/master/opencog/pln/rules/propositional>
>
>
> for examples of such rules.
>
> So, from looking at the AndLink, I gather that it can only be applied
> to EvaluationLinks, InheritanceLinks, OrLinks, NotLinks,
> and ExecutionLinks. Is there a preferred way of how to apply it (and its
> brethren) to StateLinks, (and PresentLinks, AlwaysLinks and so on)?

I suppose so, just copy/paste it and modify it to your needs. Make sure
the variables are typed. Type restriction is used to speed up the
queries, and in some cases even avoid infinite recursions.

Note the TypeInhNode

https://wiki.opencog.org/w/TypeInhNode

that allows to match subtypes as well (I've never used it, but I assume
it works fine).

Also, are you sure you want to use StateLink? I tend to think reasoning
works better on immutable structures.

Nil

>
> Best,
> Alex
>
> --
> You received this message because you are subscribed to the Google
> Groups "opencog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/f831e81c-262e-4b12-9676-2da3e30b2ae6%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/f831e81c-262e-4b12-9676-2da3e30b2ae6%40googlegroups.com?utm_medium=email&utm_source=footer>.

Alexander Gabriel

unread,
Jan 16, 2020, 9:04:54 AM1/16/20
to opencog
Also, are you sure you want to use StateLink? I tend to think reasoning
works better on immutable structures.

The robot needs to decide what to do based on the state of the human and the environment, so if the human has a crate do this, if not do that.
Thus I need to keep track of the human state which I do via StateLinks. Is that suboptimal?

Linas Vepstas

unread,
Jan 16, 2020, 4:23:07 PM1/16/20
to opencog
On Thu, Jan 16, 2020 at 7:52 AM 'Nil Geisweiller' via opencog <ope...@googlegroups.com> wrote:
On 1/16/20 3:22 PM, Alexander Gabriel wrote:
>    
> So, from looking at the AndLink, I gather that it can only be applied
> to EvaluationLinks, InheritanceLinks, OrLinks, NotLinks,
> and ExecutionLinks. Is there a preferred way of how to apply it (and its
> brethren) to StateLinks, (and PresentLinks, AlwaysLinks and so on)?

I suppose so, just copy/paste it and modify it to your needs.

Well, I'd like to disagree slightly with Nil, and urge some caution here. Not every link type is meant to be (can be, should be) treated as a function or term in classical predicate logic.

To wax philosophical, just a little bit: the atomspace is meant to be a kind-of "knowledge representation database" and as such, the goal is to allow different kinds of systems to be built on it: classical predicate logic (the "crisp" stuff) but also probabilistic logic ("PLN") but also things that are not logics at all, and do not have boolean operations like "and", "or" "not" defined for them (because they aren't evaluatable into 'truth values', or perhaps because they don't have a consistent interpretation outside of some particular context or frame...)

PresentLinks and AlwaysLinks are "reserved keywords" intended for the pattern matcher, only.  If you defocus your eyes a bit, then sure, they seem to resemble the predicate-logic "there-exists" and "for-all" .  But the were not designed for reasoning, there were designed for solving the "subgraph isomorphism problem" and for "term rewriting". So if you actually need the predicate-logic constructs "there-exists" and "for-all", then you should use the ThereExistsLink and ForAllLink.  (These have been so under-utilized in the code base that they might have been stripped out; but they could be added back in. ).

-- Linas

Alexander Gabriel

unread,
Jan 16, 2020, 4:28:05 PM1/16/20
to opencog

PresentLinks and AlwaysLinks are "reserved keywords" intended for the pattern matcher, only.  If you defocus your eyes a bit, then sure, they seem to resemble the predicate-logic "there-exists" and "for-all" .  But the were not designed for reasoning, there were designed for solving the "subgraph isomorphism problem" and for "term rewriting". So if you actually need the predicate-logic constructs "there-exists" and "for-all", then you should use the ThereExistsLink and ForAllLink.  (These have been so under-utilized in the code base that they might have been stripped out; but they could be added back in. ).

Hi Linas,
those are binding though, right? So, how do I combine them with their own kind as well as other links in a consistently binding way?

best,
Alex

Linas Vepstas

unread,
Jan 16, 2020, 4:57:34 PM1/16/20
to opencog
Should be OK. After all, the StateLink was invented for robot control :-) However... some history might help:

When the StateLink was invented, the intent was for it to be used to build "behavior trees" https://en.wikipedia.org/wiki/Behavior_tree_(artificial_intelligence,_robotics_and_control)

The intended usage was to have some sensory system (ROS) punch atoms into the StateLink, tracking external reality.  Then, in the atomspace, there would be a collection of rules, written using SequentialAndLink and SequentialOrLink to implement the behavior-tree "selector" and "sequencer" concepts.  The current state of the Statelink would be accessed via GetLink's that would run whenever some behavior tree triggered.

No one ever day-dreamed about using StateLink in a predicate-logic or reasoning system.  It might be usable as such, but .. this is fresh territory.

Next: when StateLink was invented, neither the URE nor PLN were in a usable state. Also, at that time, the "openpsi" system was being developed as an alternative rule-selection and scheduling system. (That's because URE has certain scalability problems aka "combinatorial explosion" when there's a lot of rules; the openpsi system had/has a way of beating down the combinatorial explosion.)  So anyway, no one ever ran any of the behavior-tree robot-control rules within URE or PLN; they were run either hard-coded, or in openspi.   So .. again .. unexplored territory.  Oh, and openpsi "mostly works" but is also a kind-of unfinished project.

Meanwhile, back at the farm ... tracking state with the StateLink is  .. OK, but not terribly scalable if there's a lot of state.  The reason for this is that any update to a StateLink requires punching it into the atomspace, and there's CPU overhead in that.  ... and "most users" probably don't need to put things into the atomspace.  The "only reason" to put something in the atomspace is to "remember it" for later graph-search, ... or for reasoning. 

There is an alternative way to track state: use FloatValue or StringValue (or the extensions thereof). These are like TruthValue, but do not have a pre-defined interpretation as "truth" - they can represent "anything". They also do not pay the over-head of insertion into the atomspace, which makes them (much?) faster. The down-side is that they cannot be searched over. You have to know their precise location to use them, as otherwise they are not findable/searchable.  So for example:

(ConceptNode "gripper hand")  ;; a well-known location in the atomspace
(PredicateNode "3D location")   ;; a well-known key for key-value tagging.

(cog-set-value!
     (ConceptNode "gripper hand")
     (PredicateNode "3D location")
     (FloatValue 0.1 0.2 0.3333))          ; update the "state" of the gripper location

(cog-value
     (ConceptNode "gripper hand")
     (PredicateNode "3D location"))    ; Get the current state of the gripper

and if you want to use this in PLN/URE/etc, then:

(ValueOfLink
     (ConceptNode "gripper hand")
     (PredicateNode "3D location")))

which is vaguely like StateLink, except its ... well, different. whatever.  This provides an alternative design point for state management and state tracking, but has never moved beyond a proof-of-concept.  I really like the concept, but I know that in reality, you have to actually try to build one to see how well it might actually work.

-- Linas

Linas Vepstas

unread,
Jan 16, 2020, 5:08:46 PM1/16/20
to opencog
Since the  ExistsLink and ForAllLink are more-or-less unused, and as such, they do not really have any well-defined semantics.  I guess the PLN book talks about them ... but the book and the code-base are divergent in various ways.  I suspect that there are no PLN rules written for them (I don't know).   If I look at the code, I see this:

atom_types.script:FORALL_LINK <- SCOPE_LINK,CRISP_OUTPUT_LINK "ForAllLink"
atom_types.script:EXISTS_LINK <- SCOPE_LINK,CRISP_OUTPUT_LINK

I'm pretty sure I wrote that because it seemed to "make sense" at the time.  So, yes a ScopeLink is "binding" (if we're talking about the same thing). 

This is a good time to narrow-down and give a precise semantics for these two link-types.  And/or use or abuse them, since they are currently lying fallow, unclaimed, unused.

-- Linas

Nil Geisweiller

unread,
Jan 20, 2020, 2:55:49 AM1/20/20
to ope...@googlegroups.com
On 1/17/20 12:08 AM, Linas Vepstas wrote:> Since the  ExistsLink and
ForAllLink are more-or-less unused, and as
> such, they do not really have any well-defined semantics.  I guess the
> PLN book talks about them ... but the book and the code-base are
> divergent in various ways.  I suspect that there are no PLN rules

ExistsLink and ForAllLink have well defined PLN semantics (explained
somewhere in http://goertzel.org/PLN_BOOK_6_27_08.pdf), and have one or
two badly implemented rules
https://github.com/opencog/pln/tree/master/opencog/pln/rules/wip.

They have been underused because in practice implication/inheritance
tend to suffice (and can be used to reason about conditional
generalization/instantiation). Once we get back to OpenCog as artificial
mathematician, progress will likely continue on that front.

Nil

> written for them (I don't know).   If I look at the code, I see this:
>
> atom_types.script:FORALL_LINK <- SCOPE_LINK,CRISP_OUTPUT_LINK "ForAllLink"
> atom_types.script:EXISTS_LINK <- SCOPE_LINK,CRISP_OUTPUT_LINK
>
> I'm pretty sure I wrote that because it seemed to "make sense" at the
> time.  So, yes a ScopeLink is "binding" (if we're talking about the same
> thing).
>
> This is a good time to narrow-down and give a precise semantics for
> these two link-types.  And/or use or abuse them, since they are
> currently lying fallow, unclaimed, unused.
>
> -- Linas
>
> --
> cassette tapes - analog TV - film cameras - you
>
> --
> You received this message because you are subscribed to the Google
> Groups "opencog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/CAHrUA36yW87i8aysd4%2BXmE832rkLEb6BdOBaq3x0EQH0tAhcJw%40mail.gmail.com
> <https://groups.google.com/d/msgid/opencog/CAHrUA36yW87i8aysd4%2BXmE832rkLEb6BdOBaq3x0EQH0tAhcJw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Nil Geisweiller

unread,
Jan 20, 2020, 9:04:44 AM1/20/20
to ope...@googlegroups.com
I can't really tell, I've never used StateLink. As Linas suggested Value
might be better for various reasons. But as an AI-via-reasoning
fundamentalist I would think ideally you should avoid immutable
structures. That means for instance recording perceptions through time,
via for instance AtTimeLink, as opposed to changing states.

Doing this makes it easier to acquire a consciousness of time, but it's
obviously much more expensive. You have to learn (or have the system
learn) what to store in long-term memory, what to discard, etc.

I wish I could tell you more on the practical side but unfortunately I
lack experience (would like to but I've other things on my plate). I do
intend though in the future to experiment with purely reasoning-based
intelligent agents. I tend to think, as inefficient as it is today, is a
gold mine for AGI research.

Nil

>
> --
> You received this message because you are subscribed to the Google
> Groups "opencog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/5a0fbe52-0efb-4d16-a0ec-853af46dfd6f%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/5a0fbe52-0efb-4d16-a0ec-853af46dfd6f%40googlegroups.com?utm_medium=email&utm_source=footer>.

Linas Vepstas

unread,
Jan 21, 2020, 12:29:40 PM1/21/20
to opencog
On Mon, Jan 20, 2020 at 8:04 AM 'Nil Geisweiller' via opencog <ope...@googlegroups.com> wrote:

I can't really tell, I've never used StateLink. As Linas suggested Value
might be better for various reasons. But as an AI-via-reasoning
fundamentalist I would think ideally you should avoid immutable
structures. That means for instance recording perceptions through time,
via for instance AtTimeLink, as opposed to changing states.

Doing this makes it easier to acquire a consciousness of time, but it's
obviously much more expensive. You have to learn (or have the system
learn) what to store in long-term memory, what to discard, etc.

Nil, this is an important point, so let me belabor it a bit. So, first, Values allow gigapixels per second of data to be processed, without piping them all into the AtomSpace.  But, if needed, they can be sampled, using e.g. ValueOfLink, TruthValueOfLink, ConfidenceOfLink, StrengthOfLink, the last two taking ordinary, highly mutable SimpleTV's grabbing the numerical values in them and stuffing them into NumberNodes.  The analogy here is that the neurons in my eyeballs are recording gigapixels per second, but that data is not pumped into the hippocampus, turned into memories, recorded as a movie-of-my-life, 60fps 24x7. No, only a few select images are remembered.

Another way to think of immutable atoms vs mutable values is like pipes and water. Imagine, say, a refinery: pipes everywhere: these are "immutable", processing the stuff flowing through them.  A better analogy, maybe: a GPU, processing pixels, with an effectively immutable pipeline algo (i.e. you don't change the GPU algo more often than once every few seconds, and in practice, it only changes every few hours, or minutes. Its "immutable")  You *can* perform "reasoning" on the GPU algo - after all its just a bunch of code, and your reasoning engine can deduct new gpu algos, as needed.  A good example is tensorflow: if you look at the tensorflow specification language, it looks a whole lot like atomese. No surprise. What does it do? It specifies the wiring diagram for some specific neural net. What are those neurons doing? gigapixls per second of something.

So Atoms are for wiring diagrams, Values are for the currents that flow through the diagrams. Classical theorem-proving, and forward/backward chaining build new wiring diagrams. Classical (predicate) logic has very simple Values: True, False, which can be assigned to nodes in the wiring diagram, independently of the wiring itself.  PLN generalizes the "flowing things" to probabilities+confidence. Values generalize a bit more: any kind of "stuff", colors, 3d coords, whatever, but really anything.

Then things like StateLink and ValueOfLink are just assorted extra gadgets that one needs, in practice, to do assorted specialty things.  AtTimeLink is OK for forming occasional memories of a changing external world, but I doubt you need it for "consciousness" of time.  I think you can gain that just fine by taking snapshots of Values with ValueOfLink and/or holding slowly-mutating state in StateLink.

So the above is just the "vision", its important to understand that vision.  Of course, doing something with it, in practice, is a lot harder :-)

Reply all
Reply to author
Forward
0 new messages