On Sun, Mar 1, 2020 at 8:55 PM Alexander Gabriel <[email protected]> wrote:

> Hi guys!
>
> I've run into a performance problem.
>
> When I run the backward chainer with this query:
> (GetLink
>   (VariableList
>     (TypedVariableLink (VariableNode "picker") (TypeNode "ConceptNode"))
>     (TypedVariableLink (VariableNode "human") (TypeNode "ConceptNode"))
>     (TypedVariableLink (VariableNode "place1") (TypeNode "ConceptNode"))
>     (TypedVariableLink (VariableNode "origin") (TypeNode "ConceptNode"))
>     (TypedVariableLink (VariableNode "destination") (TypeNode
> "ConceptNode")))
>   (AndLink
>     (InheritanceLink (VariableNode "picker") (VariableNode "human"))
>     (StateLink (ListLink (VariableNode "picker") (PredicateNode "called
> robot")) (ConceptNode "FALSE"))
>     (StateLink (ListLink (VariableNode "picker") (PredicateNode
> "seen_picking")) (ConceptNode "FALSE"))
>     (StateLink (ListLink (VariableNode "picker") (PredicateNode
> "movement")) (ConceptNode "APPROACHING"))
>     (StateLink (VariableNode "picker") (VariableNode "place1"))
>     (EvaluationLink (PredicateNode "leads_to") (ListLink (VariableNode
> "place1") (VariableNode "origin")))
>     (StateLink (ConceptNode "Thorvald_001") (VariableNode "origin"))
>     (EvaluationLink (PredicateNode "leads_to") (ListLink (VariableNode
> "origin") (VariableNode "destination")))
>   )
> )
>
> It takes only 0.004 seconds on my database.
>
> But if I run the same query without the encompassing GetLink
>   (AndLink
>     (InheritanceLink (VariableNode "picker") (VariableNode "human"))
>     (StateLink (ListLink (VariableNode "picker") (PredicateNode "called
> robot")) (ConceptNode "FALSE"))
>     (StateLink (ListLink (VariableNode "picker") (PredicateNode
> "seen_picking")) (ConceptNode "FALSE"))
>     (StateLink (ListLink (VariableNode "picker") (PredicateNode
> "movement")) (ConceptNode "APPROACHING"))
>     (StateLink (VariableNode "picker") (VariableNode "place1"))
>     (EvaluationLink (PredicateNode "leads_to") (ListLink (VariableNode
> "place1") (VariableNode "origin")))
>     (StateLink (ConceptNode "Thorvald_001") (VariableNode "origin"))
>     (EvaluationLink (PredicateNode "leads_to") (ListLink (VariableNode
> "origin") (VariableNode "destination")))
>   )
>
> It takes a whooping 5 seconds. No idea why.
>

Nil needs to examine/explain that one, I don't know.

My intuition is that this is a bug. I assume we have to solve whatever is
> in the outgoing set of the GetLink in order to return the result for the
> GetLink and so the outgoing set can be computed in less than 0.004 seconds.
>

The pattern matcher simply performs a graph-traversal, filling in the
blanks. If you had a million humans in your DB, it might take longer (not a
million times longer, but ... longer).

>
> Anyway, it seems I have to forgo the use of the GetLink because I have to
> add another condition
> (AbsentLink (StateLink (VariableNode "person2"), (VariableNode
> "destination")))
>
> to make sure that there is nobody at the destination and the waypoint is
> free. And adding this only works if I don't use the wrapping GetLink, my
> guess is that adding the GetLink doesn't give any results because there is
> no grounding for (VariableNode "person2") if there is nobody at the
> waypoint.
>

Oh, that's interesting. My knee-jerk reaction is that GetLink should have
worked with AbsentLink, but I'm also certain there is no unit test for
this, and so am not surprised there's a bug.  This has an obvious solution:
Get should not report variables that can't be grounded. Open a bug report;
I'll look at it the next few days. This is fixable; and its not that hard.

The 5 seconds are way too long for my application though.
>

That is a distinct issue with the backward chainer: again, that one is for
Nil to follow through on.

Is there a way to exclude a variable from being considered by the GetLink?
> I tried to exclude it from the GetLink's VariableList, but that didn't work.
>

Open a bug report (against atomspace). If you can cut-paste a full example
into the bug report, that would be best.

-- linas

>
> Thanks for your help!
>
> Best regards,
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/41de6c82-bf49-4dc0-bc3f-9773ac3973ad%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/41de6c82-bf49-4dc0-bc3f-9773ac3973ad%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/opencog/CAHrUA360D6ML%2BHzWKr_qRFpWuFa%2BO1%3D6Z1uiwwTbbdYr2yED6A%40mail.gmail.com.

Reply via email to