jsego / bfgp-pp

A framework based on Best-First Generalized Planning where solutions are either assembly-like programs, or structured programs that are syntactically terminating.
GNU General Public License v3.0
3 stars 3 forks source link
generalized-planning program-synthesis proving-programs-correct

Build Status Tests Status

BFGP++

A framework based on Best-First Generalized Planning where solutions are either assembly-like programs, or structured programs that are syntactically terminating.

Installation

  1. Prepare the virtual environment for PDDL preprocessing
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    pip install -e .
  2. Compile the BFGP++ generalized planner
    ./scripts/compile.sh

Running Example

1. Synthesis Mode

Synthesis of a generalized plan with 8 lines for Gripper domain:

./main.bin -m synthesis -l 8 -f domains/gripper/synthesis/ -o gripper -pgp True

The returned strategy, must pick a ball from room A, move to room B, drop the ball and get back to room A for the next ball, until all balls have been moved. This is represented with the following planning program:

0. for(ptr_ball_0++,6)
1. pick(ptr_ball_0,ptr_room_0,ptr_gripper_0)
2. inc(ptr_room_1)
3. move(ptr_room_0,ptr_room_1)
4. drop(ptr_ball_0,ptr_room_1,ptr_gripper_0)
5. move(ptr_room_1,ptr_room_0)
6. endfor(ptr_ball_0++,0)
7. end

2. Validation Mode

Validation of the planning program above in easy, medium and hard Gripper problems:

./main.bin -m validation-prog -p gripper.prog -f domains/gripper/validation/easy/
./main.bin -m validation-prog -p gripper.prog -f domains/gripper/validation/medium/
./main.bin -m validation-prog -p gripper.prog -f domains/gripper/validation/hard/ 

The results will be placed in experiments/gripper/validation/ folder, where all files should contain the input program, the number of input instance, whether the GOAL has been achieved for all instances, and the execution time, e.g., the output for the medium difficulty command is:

[INFO] Parsed domain. [0.000s]
[INFO] Generalized Domain created. [0.000s]
[INFO] Generalized Planning Problem created. [0.032s]
[INFO] Program loaded: [0.000s]
[INFO] Read program:
0. for(ptr_ball_0++,6)
1. pick(ptr_ball_0,ptr_room_0,ptr_gripper_0)
2. inc(ptr_room_1)
3. move(ptr_room_0,ptr_room_1)
4. drop(ptr_ball_0,ptr_room_1,ptr_gripper_0)
5. move(ptr_room_1,ptr_room_0)
6. endfor(ptr_ball_0++,0)
7. end

[INFO] Number of instances: 10
[INFO] GOAL ACHIEVED!
[INFO] Total time: [0.153s]

3. Repair Mode

It is similar to synthesis mode in that it synthesizes a solution for a generalized planning problem, but requires an initial planning program which might be repaired, e.g., find the generalized plan above given the following program, located in domains/gripper/repair/gripper.prog, where only the first loop is programmed:

0. for(ptr_ball_0++,6)
1. empty
2. empty
3. empty
4. empty
5. empty
6. endfor(ptr_ball_0++,0)
7. end

The solution will be found much faster than in synthesis mode for this case. Run the repair mode as follows:

./main.bin -m repair -f domains/gripper/synthesis/ -p domains/gripper/repair/gripper.prog -pgp True 

Input Arguments

The framework has a helper to guide the user with the required input arguments for each running mode. Next we list some of the most important:

References