opencog / rocca

Rational OpenCog Controlled Agent (ROCCA). Use OpenCog to control a rational agent in OpenAI Gym and Malmo environments.
GNU Affero General Public License v3.0
30 stars 18 forks source link

Add human readable cogscm rendering function + lots of log msgs improvements #55

Closed ngeiswei closed 2 years ago

ngeiswei commented 2 years ago

The main addition of this PR is a function to turn cognitive schematics such as

(BackPredictiveImplicationScopeLink (stv 1 0.00891089)
  (VariableSet
  ) ; [80075fffffff523a][3]
  (SLink
    (ZLink
    ) ; [800fbffffffe8ce4][3]
  ) ; [da5f815ba9d4009f][3]
  (BackSequentialAndLink
    (SLink
      (ZLink
      ) ; [800fbffffffe8ce4][3]
    ) ; [da5f815ba9d4009f][3]
    (AndLink (stv 0.1 0.2)
      (ExecutionLink
        (SchemaNode "Go Left") ; [7ca250f2efc2e872][3]
      ) ; [c7fb76d9605d5db5][3]
      (EvaluationLink (stv 0.605 0.2)
        (PredicateNode "Agent Position") ; [3fdca752fd5e5335][3]
        (ConceptNode "Right Square") ; [6dd382acb6aa376e][3]
      ) ; [c9fcc2094e0150df][3]
      (EvaluationLink (stv 0.61 0.2)
        (PredicateNode "Pellet Position") ; [56e6ab0f525cb504][3]
        (ConceptNode "Left Square") ; [586f8a0db3b1388a][3]
      ) ; [eff67c574737d4d6][3]
    ) ; [90be7e9894b149fd][3]
    (ExecutionLink
      (SchemaNode "Eat") ; [3fe4e22345c3679f][3]
    ) ; [9efce1dc8918c209][3]
  ) ; [f64d0fb50dd6139c][3]
  (EvaluationLink (stv 0.075 0.2)
    (PredicateNode "Reward") ; [155bb4d713db0d51][3]
    (NumberNode "1") ; [2cf0956d543cff8e][3]
  ) ; [d3cee8bdda06ffcb][3]
) ; [e5b935e5eae8c50c][3]

into

AgentPosition(RightSquare) ∧ PelletPosition(LeftSquare) ∧ do(GoLeft) ≺ do(Eat) ↝ Reward(1)

making for much more readable log messages.