Skip to content

Commit

Permalink
New domain: Single Rover (#10)
Browse files Browse the repository at this point in the history
Single rover domain support.
  • Loading branch information
maxzuo authored Sep 3, 2024
1 parent 6d50076 commit 714b93e
Show file tree
Hide file tree
Showing 20 changed files with 4,209 additions and 1,854 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
with:
python-version: "3.10"

- name: Setup apptainer
uses: eWaterCycle/setup-apptainer@v2.0.0

- name: install poetry
uses: snok/install-poetry@v1
with:
Expand All @@ -29,10 +32,27 @@ jobs:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: load downward
id: cached-downward
uses: actions/cache@v3
with:
path: tmp/
key: downward-${{ runner.os }}-${{ hashFiles('**/VAL.zip') }}-${{ hashFiles('fast-downward.sif') }}

- name: install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: install downward
if: steps.cached-downward.outputs.cache-hit != 'true'
run: |
mkdir tmp
apptainer pull fast-downward.sif docker://aibasel/downward:latest
mv fast-downward.sif tmp/
curl -o tmp/VAL.zip https://dev.azure.com/schlumberger/4e6bcb11-cd68-40fe-98a2-e3777bfec0a6/_apis/build/builds/77/artifacts?artifactName=linux64\&api-version=7.1\&%24format=zip
unzip tmp/VAL.zip -d tmp/
tar -xzvf tmp/linux64/*.tar.gz -C tmp/ --strip-components=1
- name: install project
run: poetry install --no-interaction

Expand All @@ -46,10 +66,7 @@ jobs:
- name: test
run: |
source .venv/bin/activate
mkdir tmp
curl -o tmp/VAL.zip https://dev.azure.com/schlumberger/4e6bcb11-cd68-40fe-98a2-e3777bfec0a6/_apis/build/builds/77/artifacts?artifactName=linux64\&api-version=7.1\&%24format=zip
unzip tmp/VAL.zip -d tmp/
tar -xzvf tmp/linux64/*.tar.gz -C tmp/ --strip-components=1
export DOWNWARD=$(pwd)/tmp/fast-downward.sif
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/tmp/bin
export PATH=$PATH:$(pwd)/tmp/bin
poetry run pytest --cov-fail-under=90 --cov=planetarium --timeout=120 tests/.
32 changes: 32 additions & 0 deletions planetarium/ASSUMPTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Assumptions

For each domain, the following assumptions are made regarding the types of problems evaluated.
We also assume that problems are solvable via the domain's actions.

Our equivalence check is based on the assumption that the problems are solvable already (i.e. our evaluator checks solvability before equivalence).

## Blocksworld

Generally, since Blocks World has reversible actions, essentially all problems are evaluable.

`:init` conditions:
- No two blocks are on top of a single block
- No block is initialized on top of two blocks
- No loops of blocks are made
- Arm can only hold one block

## Grippers

Generally, since Grippers has reversible actions, essentially all problems are evaluable.

`:init` conditions:
- No double "typing" of objects (we don't using `:typing`, we use certain immutable predicates)
- All balls have only one location
- All grippers have only one location
- All grippers hold up to 1 ball

## Rover Single
Rover has the capability of being a much more complex domain, but for the purposes of this benchmark, we work only with a single rover and a single lander.

`:init` conditions:
- No double `at_*` predicates (rover and lander can only be in one location at a time)
43 changes: 43 additions & 0 deletions planetarium/domains/blocksworld.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
;; source: https://github.com/AI-Planning/pddl-generators/blob/main/blocksworld/domain.pddl
;; same as used in IPC 2023
;;
(define (domain blocksworld)

(:requirements :strips)

(:predicates
(clear ?x)
(on-table ?x)
(arm-empty)
(holding ?x)
(on ?x ?y)
)

(:action pickup
:parameters (?ob)
:precondition (and (clear ?ob) (on-table ?ob) (arm-empty))
:effect (and (holding ?ob) (not (clear ?ob)) (not (on-table ?ob))
(not (arm-empty)))
)

(:action putdown
:parameters (?ob)
:precondition (holding ?ob)
:effect (and (clear ?ob) (arm-empty) (on-table ?ob)
(not (holding ?ob)))
)

(:action stack
:parameters (?ob ?underob)
:precondition (and (clear ?underob) (holding ?ob))
:effect (and (arm-empty) (clear ?ob) (on ?ob ?underob)
(not (clear ?underob)) (not (holding ?ob)))
)

(:action unstack
:parameters (?ob ?underob)
:precondition (and (on ?ob ?underob) (clear ?ob) (arm-empty))
:effect (and (holding ?ob) (clear ?underob)
(not (on ?ob ?underob)) (not (clear ?ob)) (not (arm-empty)))
)
)
38 changes: 38 additions & 0 deletions planetarium/domains/gripper.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
;; source: https://github.com/AI-Planning/pddl-generators/blob/main/gripper/domain.pddl
(define (domain gripper)
(:requirements :strips)
(:predicates
(room ?r)
(ball ?b)
(gripper ?g)
(at-robby ?r)
(at ?b ?r)
(free ?g)
(carry ?o ?g)
)

(:action move
:parameters (?from ?to)
:precondition (and (room ?from) (room ?to) (at-robby ?from))
:effect (and (at-robby ?to)
(not (at-robby ?from)))
)

(:action pick
:parameters (?obj ?room ?gripper)
:precondition (and (ball ?obj) (room ?room) (gripper ?gripper)
(at ?obj ?room) (at-robby ?room) (free ?gripper))
:effect (and (carry ?obj ?gripper)
(not (at ?obj ?room))
(not (free ?gripper)))
)

(:action drop
:parameters (?obj ?room ?gripper)
:precondition (and (ball ?obj) (room ?room) (gripper ?gripper)
(carry ?obj ?gripper) (at-robby ?room))
:effect (and (at ?obj ?room)
(free ?gripper)
(not (carry ?obj ?gripper)))
)
)
90 changes: 90 additions & 0 deletions planetarium/domains/rover-single.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
(define (domain rover-single)
(:requirements :strips :typing)
(:types
waypoint store camera mode objective
)

(:predicates
(at_rover ?y - waypoint)
(at_lander ?y - waypoint)
(can_traverse ?x - waypoint ?y - waypoint)
(empty ?s - store)
(have_rock_analysis ?w - waypoint)
(have_soil_analysis ?w - waypoint)
(full ?s - store)
(supports ?c - camera ?m - mode)
(available)
(visible ?w - waypoint ?p - waypoint)
(have_image ?o - objective ?m - mode)
(communicated_soil_data ?w - waypoint)
(communicated_rock_data ?w - waypoint)
(communicated_image_data ?o - objective ?m - mode)
(at_rock_sample ?w - waypoint)
(at_soil_sample ?w - waypoint)
(visible_from ?o - objective ?w - waypoint)
(channel_free)
)

(:action navigate
:parameters (?y - waypoint ?z - waypoint)
:precondition (and (can_traverse ?y ?z) (available) (at_rover ?y)
(visible ?y ?z))
:effect (and (not (at_rover ?y)) (at_rover ?z))
)

(:action sample_soil
:parameters (?s - store ?p - waypoint)
:precondition (and (at_rover ?p) (at_soil_sample ?p) (empty ?s))
:effect (and (not (empty ?s)) (full ?s) (have_soil_analysis ?p)
(not (at_soil_sample ?p)))
)

(:action sample_rock
:parameters (?s - store ?p - waypoint)
:precondition (and (at_rover ?p) (at_rock_sample ?p) (empty ?s))
:effect (and (not (empty ?s)) (full ?s) (have_rock_analysis ?p)
(not (at_rock_sample ?p)))
)

(:action drop
:parameters (?y - store)
:precondition (full ?y)
:effect (and (not (full ?y)) (empty ?y))
)

(:action take_image
:parameters (?p - waypoint ?o - objective ?i - camera ?m - mode)
:precondition (and (supports ?i ?m) (visible_from ?o ?p) (at_rover ?p))
:effect (have_image ?o ?m)
)

(:action communicate_soil_data
:parameters (?p - waypoint ?x - waypoint ?y - waypoint)
:precondition (and (at_rover ?x)
(at_lander ?y)(have_soil_analysis ?p)
(visible ?x ?y)(available)(channel_free))
:effect (and (not (available))
(not (channel_free))(channel_free)
(communicated_soil_data ?p)(available))
)

(:action communicate_rock_data
:parameters (?p - waypoint ?x - waypoint ?y - waypoint)
:precondition (and (at_rover ?x)
(at_lander ?y)(have_rock_analysis ?p)
(visible ?x ?y)(available)(channel_free))
:effect (and (not (available))
(not (channel_free))
(channel_free)(communicated_rock_data ?p)(available))
)

(:action communicate_image_data
:parameters (?o - objective ?m - mode ?x - waypoint ?y - waypoint)
:precondition (and (at_rover ?x)
(at_lander ?y)(have_image ?o ?m)
(visible ?x ?y)(available)(channel_free))
:effect (and (not (available))
(not (channel_free))(channel_free)
(communicated_image_data ?o ?m)(available))
)
)
111 changes: 111 additions & 0 deletions planetarium/domains/rover.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
;; source: https://github.com/AI-Planning/pddl-generators/blob/main/rovers/domain.pddl
;; same as used in IPC 2023
;;
(define (domain rover)
(:requirements :strips :typing)
(:types
rover waypoint store camera mode lander objective
)

(:predicates
(at ?x - rover ?y - waypoint)
(at_lander ?x - lander ?y - waypoint)
(can_traverse ?r - rover ?x - waypoint ?y - waypoint)
(equipped_for_soil_analysis ?r - rover)
(equipped_for_rock_analysis ?r - rover)
(equipped_for_imaging ?r - rover)
(empty ?s - store)
(have_rock_analysis ?r - rover ?w - waypoint)
(have_soil_analysis ?r - rover ?w - waypoint)
(full ?s - store)
(calibrated ?c - camera ?r - rover)
(supports ?c - camera ?m - mode)
(available ?r - rover)
(visible ?w - waypoint ?p - waypoint)
(have_image ?r - rover ?o - objective ?m - mode)
(communicated_soil_data ?w - waypoint)
(communicated_rock_data ?w - waypoint)
(communicated_image_data ?o - objective ?m - mode)
(at_soil_sample ?w - waypoint)
(at_rock_sample ?w - waypoint)
(visible_from ?o - objective ?w - waypoint)
(store_of ?s - store ?r - rover)
(calibration_target ?i - camera ?o - objective)
(on_board ?i - camera ?r - rover)
(channel_free ?l - lander)
)

(:action navigate
:parameters (?x - rover ?y - waypoint ?z - waypoint)
:precondition (and (can_traverse ?x ?y ?z) (available ?x) (at ?x ?y)
(visible ?y ?z))
:effect (and (not (at ?x ?y)) (at ?x ?z))
)

(:action sample_soil
:parameters (?x - rover ?s - store ?p - waypoint)
:precondition (and (at ?x ?p) (at_soil_sample ?p)
(equipped_for_soil_analysis ?x) (store_of ?s ?x) (empty ?s))
:effect (and (not (empty ?s)) (full ?s) (have_soil_analysis ?x ?p)
(not (at_soil_sample ?p)))
)

(:action sample_rock
:parameters (?x - rover ?s - store ?p - waypoint)
:precondition (and (at ?x ?p) (at_rock_sample ?p)
(equipped_for_rock_analysis ?x) (store_of ?s ?x)(empty ?s))
:effect (and (not (empty ?s)) (full ?s) (have_rock_analysis ?x ?p)
(not (at_rock_sample ?p)))
)

(:action drop
:parameters (?x - rover ?y - store)
:precondition (and (store_of ?y ?x) (full ?y))
:effect (and (not (full ?y)) (empty ?y))
)

(:action calibrate
:parameters (?r - rover ?i - camera ?t - objective ?w - waypoint)
:precondition (and (equipped_for_imaging ?r) (calibration_target ?i ?t)
(at ?r ?w) (visible_from ?t ?w)(on_board ?i ?r))
:effect (calibrated ?i ?r)
)

(:action take_image
:parameters (?r - rover ?p - waypoint ?o - objective ?i - camera ?m - mode)
:precondition (and (calibrated ?i ?r) (on_board ?i ?r) (equipped_for_imaging ?r)
(supports ?i ?m) (visible_from ?o ?p) (at ?r ?p))
:effect (and (have_image ?r ?o ?m)
(not (calibrated ?i ?r)))
)

(:action communicate_soil_data
:parameters (?r - rover ?l - lander ?p - waypoint ?x - waypoint ?y - waypoint)
:precondition (and (at ?r ?x)
(at_lander ?l ?y)(have_soil_analysis ?r ?p)
(visible ?x ?y)(available ?r)(channel_free ?l))
:effect (and (not (available ?r))
(not (channel_free ?l))(channel_free ?l)
(communicated_soil_data ?p)(available ?r))
)

(:action communicate_rock_data
:parameters (?r - rover ?l - lander ?p - waypoint ?x - waypoint ?y - waypoint)
:precondition (and (at ?r ?x)
(at_lander ?l ?y)(have_rock_analysis ?r ?p)
(visible ?x ?y)(available ?r)(channel_free ?l))
:effect (and (not (available ?r))
(not (channel_free ?l))
(channel_free ?l)(communicated_rock_data ?p)(available ?r))
)

(:action communicate_image_data
:parameters (?r - rover ?l - lander ?o - objective ?m - mode ?x - waypoint ?y - waypoint)
:precondition (and (at ?r ?x)
(at_lander ?l ?y)(have_image ?r ?o ?m)
(visible ?x ?y)(available ?r)(channel_free ?l))
:effect (and (not (available ?r))
(not (channel_free ?l))(channel_free ?l)
(communicated_image_data ?o ?m)(available ?r))
)
)
Loading

0 comments on commit 714b93e

Please sign in to comment.