Checker
About
This is the user manual of the solution checker of asprilo.
Encoding Structure
The checker’s encoding is compartmentalized into several parts with respect to
-
the problem domain, i.e., all encodings related to a domain
DOMAINare stored in a separate directory./checker/encodings/DOMAIN/, .e.g../checker/encodings/a/for the A domain -
the initial environmental state and the general law of inertia stored in
./checker/encodings/DOMAIN/init.lp, .e.g../checker/encodings/a/init.lpfor the A domain - the types of action laws to verify, that is,
-
action preconditions and related inertial abnormals stored in
./checker/encodings/DOMAIN/ACTIONfor each action typeACTION, e.g. for the A domain’s action typesmove,pickup,putdownanddeliver, the respective encodings are./checker/encodings/a/action-move.lp ./checker/encodings/a/action-pickup.lp ./checker/encodings/a/action-putdown.lp ./checker/encodings/a/action-deliver.lp -
static laws stored in
./checker/encodings/DOMAIN/static.lp, e.g../checker/encodings/a/static.lpfor the A domain
-
- the goal condition stored in
./checker/encodings/DOMAIN/goal.lp, .e.g. for the A,./checker/encodings/a/goal.lp
For each DOMAIN, all action law encodings are then integrated via #include directives in the
encoding ./checker/encodings/DOMAIN/checker.lp, .e.g. ./checker/encodings/a/checker.lp
for the A domain.
How To Use
Within a problem domain DOMAIN, to check a plan file PLAN for an instance file
INSTANCE run
clingo ./checker/encodings/DOMAIN/checker.lp INSTANCE PLAN
Any inconsistencies will then be indicated by err/3 atoms in the answer set, which are defined
in the checker’s encoding files. Moreover, err/3 facts adhere to the format
err(FileID, CheckID, Parameters)
where
FileIDindicates the encoding file in which the yieldederr/3atom is definedCheckIDindicates the specific ’check’, i.e., a rule that defines theerr/3atomParametersthe relevant term parameters in the body of the rule
E.g., for the A domain and instance ./examples/a/instance.asp, the (invalid) plan
./examples/a/wrong_outcome.txt can be checked via
clingo ./checker/encodings/a/checker.lp ./examples/a/small/x11_y6_n66_r3_s12_ps2_pr5_u50_o3_N001.lp \
./examples/a/small/wrong_outcome.txt --out-ifs="\n"|grep err
which yields:
err(deliver,orderAmount,(1,23))
err(deliver,shelfAmount,(1,23))
err(goal,unfilledOrder,(1,2,1,29))
Those err/3 facts are defined in ./checker/encodings/a/action-deliver.lp and
./checker/encodings/a/goal.lp by rules:
err(deliver, orderAmount, (R, T)) :- occurs(object(robot, R), action(deliver, (O, P, Q)), T);
holds( object(order, O), value( line, (P, RQ) ), T-1);
Q > RQ.
err(deliver, shelfAmount, (R, T)) :- occurs(object(robot, R), action(deliver, (O, P, Q)), T);
holds( object(robot, R), value(carries, S ), T-1);
holds( object(product, P), value(on, (S, SQ) ) , T-1);
Q > SQ.
err(goal, unfilledOrder, (O, P, Q, H)) :- holds(object(order, O), value(line, (P, Q)), H);
horizon(H).
that indicate that the plan contains inconsistencies with respect to the domain definition. Specifically,
err(deliver,orderAmount,(1,23))indicates that robot1delivered more products than requested at time step23err(deliver,shelfAmount,(1,23))indicates that robot1removed from the shelf it carries more than the available amount of a product at time step23err(goal,unfilledOrder,(1,2,1,29))indicates that order1still requires1units of product2at the final time step29.