IIIM-IS / AERA

Other
12 stars 4 forks source link

In reduce, copy f_imdl before calling predict #246

Closed jefft0 closed 1 year ago

jefft0 commented 1 year ago

The pull request resolves issue #245. See that for background. As expected, the information of grabbing the cube (not the sphere) wasn't being carried through to PTPX. This information is created by the controller for the grab model which calls predict twice in a loop, to predict grabbing the cube on the first iteration and to predict grabbing the sphere on the second iteration. The problem is that the code reuses one copy of f_imdl, so that on the second iteration the imdl with the information for the cube is replaced by the information for the sphere. The solution is to not reuse the f_imdl.

This pull request updates the loop to make a fresh copy of the f_imdl on each iteration so that the inner imdl is not replaced. (This is similar to what is already done in check_simulated_imdl to make a copy of the f_imdl.) Now, the second model made by PTPX predicts the failure of grabbing the cube, as desired:

mdl_1441:(mdl [] []
   (fact (icst cst_1439 [] [Hand: Cube: P: Sphere:]) T0: T1:)
   (|fact (imdl mdl_252 [[] T0: T1:] [Hand: Cube: v7: v8:]) T0: T1:))