Python library to encode in a declarative way the epistemic multi-agent planning problem.
You can simply use pip install bash command:
pip install echosys
After importing the library with:
from ECHO import *
you can define new types:
stack = IntType("stak", 1, 3)
color = EnumType("color", ["red", "orange", "yellow", "black"])
color_pair = StructType("colorxcolor", [color, color])
once the types are defined, you can define fluents:
on_block = Fluent("on_block", color_pair)
top = Fluent("top", color)
gripped = Fluent("gripped", color)
free_gripper = Fluent("free_gripper")
note that free_gripper is to be considered as a boolean fluent.
Often it happens that you want to define ”schemata” actions, therefore, our library provides the means to define variables as well:
C1 = Variable("C1", color)
C2 = Variable("C2", color)
A1 = Variable("i", agent)
Classical actions are defined in the following way:
pick = IAction(name = "pick",
params = [C1, C2],
precondition = [top(C1), on_block(C1, C2), free_gripper()],
effects = [-top(C1), -on_block(C1, C2), top(C2), -free_gripper(), gripped(C1)])
Note that free_gripper
is a flunet, while free_gripper()
is a literal. To negate a literal
add -
before the predicate.
Epistemic actions are defined in the following way:
pick_from_stack_place_on_table = MEAction('pspt',
params = [A1, C1],
precondition = [owner(A1, C1), free_table(), B([A1], free_table())],
effects=[-owner(A1, C1), on_table(C1), -free_table()],
full_obs=[A1])
The code is complient with the EPDDL syntax.
Basic types, fluents, variables and actions are then added to the planning problems, for instance:
p = ClassicalPlanningProblem()
ep = MEPlanningProblem()
p.add_type(color)
p.add_fluent(free_table)
p.add_action(pick)
#and similar for ep
At the end you can combine the two planning problems with:
echo_problem = ECHOPlanningProblem(p, e)
You can solve the following planning problems:
classical_plan = solve_classical(p)
epistemic_plan = solve_epddl(ep)
echo_plan = solve_echo(echo_problem)
To see a set of complete and working examples of planning problems defined and solved using ECHO python library we remind you to the examples folder.