Skip to content

aig-upf/temporal-planning

Repository files navigation

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.

  1. Installation
    1. Fast Downward Compilation
    2. SEQ, TPSHE, TP and STP Compilation
    3. Plan Validator (VAL)
  2. Usage
    1. Automatic Usage
      1. Running a Single Planner
      2. Running a Portfolio (CP4TP)
    2. Manual Usage
      1. Generator of Domains and Problems
      2. Running the SEQ and TPSHE
      3. Running TP and STP
  3. Credits
  4. References

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.

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.

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

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.

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.

Usage

Automatic Usage

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 write seq.

    • If you want to use TPSHE, you must write she.

    • If you want to use TP, you must write tempo-i where i is the bound you want to use. For example, for bound 2 you should use tempo-2, while for bound 3 you should use tempo-3.

    • If you want to use STP, you must write stp-i where i is the bound you want to use. For example, for bound 2 you should use stp-2, while for bound 3 you should use stp-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 with TPSHE. 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

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 and TPSHE planners.

  • --validate, --no-validate: Whether to use VAL 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

Manual Usage

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

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>

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.

Credits

The planner is a modified version of the Fast Downward distribution to support temporal planning.

References

About

Algorithms for solving temporal planning problems

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published