Awesome
Temporal Planning
This documentation aims to explain how experiments with the planners introduced by [Jiménez, Jonsson and Palacios, 2015] and [Furelos-Blanco, Jonsson, Palacios and Jiménez, 2018] can be run.
You can find information of the domains contained in this repository in the corresponding folder (link).
The CP4TP (Classical Planning for Temporal Planning) planner is a portfolio planner that integrates the different temporal planners implemented in this repository: a sequential planner (SEQ
), TPSHE
, TP
and STP
. It was the runner-up of the temporal track of the International Planning Competition (IPC) in 2018. You can find further information in the official page of the competition. The code of the portfolio is uploaded here, but you can follow the instructions in this repository to run it.
<a name="installation"></a>Installation
Firstly, you have to either clone or download this repository. To clone it, you can use the following command:
git clone https://github.com/aig-upf/temporal-planning.git
Then you can run the build.sh
script inside the temporal-planning
folder to download the submodules on which this software depends as well as building the binaries (those for Fast Downward are not built, you should follow the instructions explained here.
cd temporal-planning
./build.sh
The following subsections explain how to compile the modified version of Fast Downward and how to run the TPSHE
, TP
and STP
planners.
<a name="fd-compilation"></a>Fast Downward Compilation
The Fast Downward version in this repository contains modifications to support temporal planning. However, the steps for compiling it are the same (see section "Compiling the planner" here).
For example, in case you wanted to compile the 64-bit version you should run the following commands:
cd temporal-planning
python fd_copy/build.py release64
<a name="seq-tpshe-tempo-stp-compilation"></a>SEQ, TPSHE, TP and STP Compilation
The SEQ
, TPSHE
, TP
and STP
planners are compiled by running the build.sh
script, as explained at the beginning of this section. After running this script, executable files will be created in the temporal-planning/bin
directory. In addition, that command also compiles a domain generator called generator
for the Allen Algebra domain, which is stored in temporal-planning/domains/AllenAlgebra/problems
.
<a name="plan-validator-compilation"></a>Plan Validator (VAL)
The VAL
tool by [Howey, Long and Fox, 2004] can be used to validate the resulting temporal plans. You can find this tool as a submodule in this repository. The original code of VAL
can be found in this repository. This tool was also compiled using the build.sh
script introduced at the beginning of this section.
<a name="usage"></a>Usage
<a name="automatic-usage"></a>Automatic Usage
<a name="single-planner"></a>Running a Single Planner
A Python script called plan.py
inside the bin
folder encapsulates all the required calls in order to get a plan given a planner (TPSHE
, TP
or STP
) and a temporal planning problem. You can run it as follows:
plan.py [-h] [--generator GENERATOR] [--time TIME] [--memory MEMORY] [--iterated] [--no-iterated] planner domain problem
where:
-
planner
: Name of the algorithm you want to use.-
If you want to use
SEQ
, you must writeseq
. -
If you want to use
TPSHE
, you must writeshe
. -
If you want to use
TP
, you must writetempo-i
wherei
is the bound you want to use. For example, for bound 2 you should usetempo-2
, while for bound 3 you should usetempo-3
. -
If you want to use
STP
, you must writestp-i
wherei
is the bound you want to use. For example, for bound 2 you should usestp-2
, while for bound 3 you should usestp-3
.
-
-
domain
: Path to the input domain. -
problem
: Path to the input problem. -
--generator
: Path to the executable generator for transforming the input domain and problem. It is just needed for the Allen Algebra domain. -
--time
: Maximum number of seconds during which Fast Downward will try to find a solution. Default: 3600 seconds. -
--memory
: Maximum number of MiB that Fast Downward will use to find a solution. Default: 4096 MiB. -
--iterated
,--no-iterated
: Whether to continue searching after getting the first solution, or stop after getting the first solution. These flags only work withTPSHE
. Default: search more after the first solution (iterated). -
-h
: Shows information about how to use the program.
The temporal solutions obtained by Fast Downward will be written to files whose name will begin with tmp_sas_plan.
followed by a number indicating the solution number to the problem (e.g. tmp_sas_plan.2
would be the second solution that solves the problem).
Besides, in case a plan is produced, it will be validated using the VAL
tool previously introduced. The output of the validator will be written to a file called plan.validation
.
Example 1
cd temporal-planning
python bin/plan.py she domains/AllenAlgebra/domain/domain.pddl domains/AllenAlgebra/problems/pfile10.pddl --generator domains/AllenAlgebra/problems/generator
Example 2
cd temporal-planning
python bin/plan.py tempo-2 domains/tempo-sat/Driverlog/domain/domain.pddl domains/tempo-sat/Driverlog/problems/p1.pddl
<a name="cp4tp"></a>Running a Portfolio (CP4TP)
The planners can be run in a portfolio manner, from the most to less restricted (SEQ
, TPSHE
, TP
, STP
) using the following command:
plan_portfolio.py [-h] [--plan-file PLANFILE] [--time TIME] [--memory MEMORY] [--generator GENERATOR] [--no-iterated] [--validate] [--no-validate] [--use-full-time] domain problem
where:
-
domain
: Path to the input domain. -
problem
: Path to the input problem. -
--plan-file
: Name of the output temporal plan. -
--time
: Maximum number of seconds available to find a solution. Default: 1800 seconds. -
--memory
: Maximum number of MiB that Fast Downward will use to find a solution. Default: 6000 MiB. -
--generator
: Path to the executable generator for transforming the input domain and problem. It is just needed for the Allen Algebra domain. -
--no-iterated
: Whether to stop after finding the first solution. It only works for sequential andTPSHE
planners. -
--validate
,--no-validate
: Whether to useVAL
to validate or not the resulting plan. -
--use-full-time
: Whether each planner should use all the remaining time. -
-h
: Shows information about how to use the program.
If you want to run the CP4TP
planner, which was participated in the International Planning Competition (IPC) 2018, you just need to run the command above with the following arguments:
cd temporal-planning
python bin/plan_portfolio.py --no-iterated --time 1680 --memory 6000 --use-full-time
<a name="manual-usage"></a>Manual Usage
<a name="use-generator-dom-prob"></a>Generator of Domains and Problems
As explained before, a generator is used for the AllenAlgebra domain so as to obtain the temporal domains and problems. The generator is found in the domains/AllenAlgebra/problems
folder.
The command for obtaining temporal domains and problems is the following:
./generator <input-domain> <input-problem> > <output-domain> 2> <output-problem>
Assuming that we are in the folder temporal-planning
(the root), an example would be:
./domains/AllenAlgebra/problems/generator domains/AllenAlgebra/domain/domain.pddl domains/AllenAlgebra/problems/pfile10.pddl > tdom.pddl 2> tins.pddl
<a name="use-seq-tpshe"></a>Running SEQ and TPSHE
To use SEQ
and TPSHE
, you have to run the binaries compileSequential
and compileSHE
respectively. These are placed in the bin
folder. The command follows this structure (analogous for the sequential planner):
./compileSHE <domain> <problem> > <output-domain> 2> <output-problem>
The following command is an example of how it is used for the Driverlog domain given that we are in the temporal-planning
(the root) folder:
./bin/compileSHE domains/tempo-sat/Driverlog/domain/domain.pddl domains/tempo-sat/Driverlog/problems/p10.pddl > dom.pddl 2> ins.pddl
Once the domain and the problem have been converted, we can use Fast Downward using the LAMA-2011 setting. The command is the following (use the build you used to compile Fast Downward):
python fd_copy/fast-downward.py --build release64 --alias seq-sat-lama-2011 dom.pddl ins.pddl
Since LAMA-2011 is used for these planners, a classical plan will be obtained instead of a temporal plan. The name of such plans begins with sas_plan
. To convert a classical plan into a temporal plan, you can use the planSchedule
tool of the bin
folder as follows:
./planSchedule <temporal-domain> <classical-domain> <temporal-problem> <classical-plan> > <temporal-plan>
<a name="use-tp-stp"></a>Running TP and STP
To use TP
, you have to run the binary compileTempo
placed in the bin
folder. The command follows this structure:
./compileTempo <domain> <problem> <bound> > <output-domain> 2> <output-problem>
On the other hand, to use STP
, you have to run the binary compileTempoParallel
. The command follows the same structure than in TP
:
./compileTempoParallel <domain> <problem> <bound> > <output-domain> 2> <output-problem>
The following command is an example of how TP
could be used for the Driverlog domain using bound 2 given that we are in the temporal-planning
(the root) folder. In the case of STP
, remember that you only have to change compileTempo
by compileTempoParallel
:
./bin/compileTempo domains/tempo-sat/Driverlog/domain/domain.pddl domains/tempo-sat/Driverlog/problems/p10.pddl 2 > dom.pddl 2> ins.pddl
Once the domain and the problem have been converted, we can use Fast Downward using the TP-LAMA setting. The command is the following (use the build you used to compile Fast Downward):
python fd_copy/fast-downward.py --build release64 --alias tp-lama dom.pddl ins.pddl
The output of Fast Downward will consist of temporal plans (the name of the files starts with tmp_sas_plan.
) unlike with SEQ
and TPSHE
.
<a name="credits"></a>Credits
The planner is a modified version of the Fast Downward distribution to support temporal planning.
<a name="references"></a>References
-
<a name="ref-tmp-planning-icaps15">Jiménez, S., Jonsson, A., and Palacios, H. (2015).</a> Temporal Planning With Required Concurrency Using Classical Planning. Proceedings of the 25th International Conference on Automated Planning and Scheduling.
-
<a name="ref-tmp-planning-coplas18">Furelos-Blanco, D., Jonsson, A., Palacios, H., and Jiménez, S. (2018).</a> Forward-Search Temporal Planning with Simultaneous Events. Proceedings of the 13th Workshop on Constraint Satisfaction Techniques for Planning and Scheduling (COPLAS) at the International Conference on Automated Planning and Scheduling (ICAPS-18).
-
<a name="ref-val">Howey, R., Long, D., and Fox, M. (2004).</a> VAL: Automatic plan validation, continuous effects and mixed initiative planning using PDDL. In Tools with Artificial Intelligence, 2004. ICTAI 2004. 16th IEEE International Conference on (pp. 294-301). IEEE.
-
<a name="ref-cp4tp">Furelos-Blanco, D. and Jonsson, A. (2018).</a> CP4TP: A Classical Planning for Temporal Planning Portfolio (code). Temporal Track of the International Planning Competition (IPC) 2018.