Kairos in Python: a temporal and numeric PDDL planner
(PDDL 2.1 to 3.1 and PDDL+), with its validator. The wheel also installs the kairos command.
pip install kairos-plannerimport kairos
domain = kairos.load_domain("domain.pddl")
problem = kairos.load_problem("problem.pddl", domain)
result = kairos.Planner().solve(problem, timeout=10)
if result.status == kairos.Status.SOLVED:
print(result.plan) # IPC format; result.plan.steps for the steps
print(kairos.validate(problem, result.plan).valid)
elif result.status == kairos.Status.UNSOLVABLE:
print("no plan exists (proved)")- Anytime:
Planner().plans(problem, timeout=30)yields each better plan as it comes;Planner().start(problem, on_plan=...)runs the search in its own thread (wait_first,next_plan,best,stop,wait). - Options as keywords (
timeout,memory_limit_mb,anytime,engine="m3",threads,epsilon,stop_after_no_improvement,target_cost, ...) or as aSolveOptionsobject. - Statuses:
SOLVED,UNSOLVABLE(proved),NO_PLAN_FOUND(no engine that applies is complete for the task: likely none exists, but nothing proves it),TIMEOUT,OUT_OF_MEMORY,UNSUPPORTED, ...result.diagnosticssays why there is no plan. - PDDL errors raise
kairos.PddlError; each of itsdiagnosticshas a stablecode, amessageand alocation(file, line, column). - Checking and validation:
check_domain,check_problem,validate,validate_plan,parse_plan,pddl_support(). - Planning releases the GIL (several threads can plan at once) and Ctrl-C stops it.