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
--
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/80b53020-8e47-46aa-ac1a-b7d4daab0874%40googlegroups.com.