Package: jupyddl
Python PDDL✨ A Python wrapper using JuliaPy for the PDDL.jl parser package and implementing its own planners. ✨Report Bug·Request FeatureLoved the project? Please considerdonatingto help it improve!Features 🌱✨ Built to be expanded: easy to add new planners🖥️ Supported on MacOS and Ubuntu🎌 Built with Julia and Python🔎 Uninformed Planners (DFS, BFS)🧭 Informed Planners (Dijkstra, A*, Greedy Best First)📊 Several general purpose heuristics (Goal Count, Delete Relaxation [Hmax, Hadd], Relaxed Critical Path [H1, H2, H3])🍻 Maintained (Incoming: Critical Path, Landmarks Heuristics...)Docker 🐋You can also use the project in a docker container usingdocker-pythonpddlInstall 💾Install Python (3.7.5 is the tested version)Install Julia$wgethttps://julialang-s3.julialang.org/bin/linux/x64/1.5/julia-1.5.2-linux-x86_64.tar.gz
$tar-xvzfjulia-1.5.2-linux-x86_64.tar.gz
$sudocp-rjulia-1.5.2/opt/
$sudoln-s/opt/julia-1.5.2/bin/julia/usr/local/bin/juliaInstall Julia dependencies$julia--color=yes-e'using Pkg; Pkg.add(Pkg.PackageSpec(path="https://github.com/APLA-Toolbox/PDDL.jl"))'$julia--color=yes-e'using Pkg; Pkg.add(Pkg.PackageSpec(path="https://github.com/JuliaPy/PyCall.jl"))'Package installation (only if used as library, not needed to run the scripts)$python3-mpipinstall--upgradepip
$python3-mpipinstalljupyddlIPC Script ⚔️Clone the project :$gitclonehttps://github.com/APLA-Toolbox/PythonPDDL
$cdPythonPDDL
$python3-mpipinstall-rrequirements.txt
$gitsubmoduleupdate--init//OnlyifyouneedPDDLfilesfortestingRun the script :$cdscripts/
$pythonipc.py"path_to_domain.pddl""path_to_problem.pddl""path_to_desired_output_file"The output file will show the path with a list of state, the path with a list of action and the metrics proposed by IPC2018.Basic Usage 📑If using the jupyddl pip package:If you want to use the data analysis tool, create a pddl-examples folder with pddl instances subfolders containing "problem.pddl" and "domain.pddl". (refer to APLA-Toolbox/pddl-examples)If you want to use it by cloning the project:$gitclonehttps://github.com/APLA-Toolbox/PythonPDDL
$cdPythonPDDL
$python3-mpipinstall-rrequirements.txt
$gitsubmoduleupdate--initYou should have apddl-examplesfolder containing PDDL instances.AutomatedPlanner Class 🗺️fromjupyddlimportAutomatedPlanner# takes some time because it has to instantiate the Julia interfaceapl=AutomatedPlanner("pddl-examples/dinner/domain.pddl","pddl-examples/dinner/problem.pddl)apl.available_heuristics["basic/zero","basic/goal_count","delete_relaxation/h_max","delete_relaxation/h_add"]apl.initial_state<PyCall.jlwrapPDDL.State(Set(Julog.Term[row(r1),column(c3),row(r3),row(r2),column(c2),column(c1)]),Set(Julog.Term[white(r2,c1),white(r1,c2),white(r3,c2),white(r2,c3)]),Dict{Symbol,Any}())>actions=apl.available_actions(apl.initial_state)[<PyCall.jlwrapflip_row(r1)>,<PyCall.jlwrapflip_row(r3)>,<PyCall.jlwrapflip_row(r2)>,<PyCall.jlwrapflip_column(c3)>,<PyCall.jlwrapflip_column(c2)>,<PyCall.jlwrapflip_column(c1)>]apl.satisfies(apl.problem.goal,apl.initial_state)Falseapl.transition(apl.initial_state,actions[0])<PyCall.jlwrapPDDL.State(Set(Julog.Term[row(r1),column(c3),row(r3),row(r2),column(c2),column(c1)]),Set(Julog.Term[white(r2,c1),white(r1,c1),white(r3,c2),white(r2,c3),white(r1,c3)]),Dict{Symbol,Any}())>path=apl.breadth_first_search()# computes path ([]State) with BFSprint(apl.get_state_def_from_path(path))[<PyCall.jlwrapPDDL.State(Set(Julog.Term[row(r1),column(c3),row(r3),row(r2),column(c2),column(c1)]),Set(Julog.Term[white(r2,c1),white(r1,c1),white(r3,c2),white(r2,c3),white(r1,c3)]),Dict{Symbol,Any}())>,<PyCall.jlwrapPDDL.State(Set(Julog.Term[row(r1),column(c3),row(r3),row(r2),column(c2),column(c1)]),Set(Julog.Term[white(r2,c1),white(r1,c1),white(r2,c3),white(r1,c3),white(r3,c3),white(r3,c1)]),Dict{Symbol,Any}())>,<PyCall.jlwrapPDDL.State(Set(Julog.Term[row(r1),column(c3),row(r3),row(r2),column(c2),column(c1)]),Set(Julog.Term[white(r2,c1),white(r1,c1),white(r1,c2),white(r3,c2),white(r2,c3),white(r1,c3),white(r3,c3),white(r3,c1),white(r2,c2)]),Dict{Symbol,Any}())>]print(apl.get_actions_from_path(path))[<PyCall.jlwrapflip_row(r1)>,<PyCall.jlwrapflip_row(r3)>,<PyCall.jlwrapflip_column(c2)>]DataAnalyst (more like Viz) Class 📈Make sure you have a pddl-examples folder where you run your environment that contains independent folders with "domain.pddl" and "problem.pddl" files, with those standard names. ( if you didn't generate with git submodule update )fromjupyddlimportDataAnalystda=DataAnalyst()da.plot_astar()# plots complexity statistics for all the problem.pddl/domain.pddl couples in the pddl-examples/ folderda.plot_astar(problem="pddl-examples/dinner/problem.pddl",domain="pddl-examples/dinner/domain.pddl")# scatter complexity statistics for the provided pddlda.plot_astar(heuristic_key="basic/zero")# use h=0 instead of goal_count for your computationda.plot_dfs()# same as astarda.comparative_data_plot()# Run all planners on the pddl-examples folder and plots them on the same figure, data is stored in a data.json fileda.comparative_data_plot(astar=False)# Exclude astar from the comparative plotda.comparative_data_plot(heuristic_key="basic/zero")# use zero heuristic for h based plannersda.comparative_data_plot(collect_new_data=False)# uses data.json to plot the datada.comparative_astar_heuristic_plot()# compare results of astar with all available heuristicsContribute 🆘Please seedocs/CONTRIBUTING.mdfor more details on contributing!Maintainers Ⓜ️Erwin LejeuneSampreet Sarkar