IIIM-IS / AERA

Other
12 stars 4 forks source link

PTPX: Accept a mk.val (or icst) if it shares attribute/value with an accepted mk.val #263

Closed jefft0 closed 1 year ago

jefft0 commented 1 year ago

PTPX is invoked when a prediction fails. It creates candidate models which may explain the failure. It considers "relevant" recent inputs as follows. It starts with the imdl of the failed prediction, for example when hand-grab-sphere fails to release the cube c because another object is at the same position,

(imdl mdl_282 [c (ti 500ms 600ms)] [h 600ms 700ms])

Right now, PTPX filters recent inputs and only accepts an input if it and the imdl share a term, such as c or h. But notice that this doesn't have a term for the sphere s and so information about the position of the sphere is discarded, even though it is the cause.

To fix this, we can update the criteria for accepting an input as relevant. We allow the first "pass" to use the same criterion to remove inputs that don't share a term, but instead of deleting the input which fails this test, we save it in a separate list of discarded mk.val objects or list of discarded icst objects (as appropriate). We use these as follows.

We first update the list of discarded mk.val objects and keep those which share an attribute/value with at least one accepted mk.val input. For example, the list of accepted mk.val inputs includes the hand position (mk.val h position 10) because it shares the term h with the imdl of the failed prediction. The list of discarded mk.val objects includes the sphere position (mk.val s position 10) . This has the same attribute "position" and value "10". So it is retained in the updated list of initially discarded mk.val to be considered later. It is also re-added to the list of accepted inputs.

A mk.val like (mk.val s position 10) has also been used to form an icst from a cst like:

(cst [] []
  (fact (mk.val s essence sphere) 500ms 600ms)
  (fact (mk.val s position 10) 500ms 600ms)

And such an icst can be nested inside other icsts. We must find all of these because they should be considered relevant. Therefore, we iterate through the list of discarded icst objects and use r_contains to check if it recursively contains one of the mk.val that were initially discarded. If it does, then we re-add this icst to the list of accepted inputs.

Now that the list of accepted inputs contains more relevant inputs, the PTPX code can proceed as before to process these an make models.