Here is a very domain file that moves a submarine from one location to another:
(define (domain unnamed1)
(:requirements
:strips :typing)
(:types
location; check if at command-centre, shallow water, deep water, land
personnel; human occupation
sub; vehicle
)
(:predicates
(sub_at ?s - sub ?loc - location); check if sub is at a specific location
(is_pilot ?p - personnel)
(deep_water ?loc - location)
(shallow_water ?loc - location)
(land ?loc - location)
(adjacent-to ?t1 - location ?t2 - location);
)
(:action move
:parameters
(?s - sub ?from - location ?to - location ?p - personnel ?c - capacity)
:precondition
(and
(sub_at ?s ?from); check where the subs starting location is
(or ;check if 'starting location' is adjacent to destination
(adjacent-to ?to ?from)
(adjacent-to ?from ?to)
);
(or; Check if in water
(shallow_water ?to)
(deep_water ?to)
)
(is_pilot ?p); check if member is a pilot
)
:effect
(and
(sub_at ?s ?to); sub is now at destination
(not (sub_at ?s ?from)); Sub is no longer at starting point
)
)
)
The above domain file follows three very simple requirements:
The location a submarine can move to must be adjacent to the location the submarine is already in. Ex: If the submarine is at location X and wants to move to Y, Y must be adjacent to X.
The location to be moved to must be in deep/shallow water and,
There must be a pilot onboard.
Here is a problem file that moves the submarine from the command-centre to the first location. This works.
(define (problem underwater_problem)
(:domain unnamed1)
(:objects
command-centre - location
loc1 - location
loc2 - location
persPilot - personnel
subm - sub
)
(:init
(sub_at subm command-centre)
(adjacent-to command-centre loc1)
(adjacent-to loc1 loc2)
(shallow_water loc1)
(deep_water loc2)
(is_pilot persPilot)
)
(:goal
(sub_at subm loc1)
)
)
The problem is here. I want the sub to jump across many different locations:
(define (problem underwater_problem)
(:domain unnamed1)
(:objects
command-centre - location
loc1 - location
loc2 - location
persPilot - personnel
subm - sub
)
(:init
(sub_at subm command-centre)
(adjacent-to command-centre loc1)
(adjacent-to loc1 loc2)
(shallow_water loc1)
(deep_water loc2)
(is_pilot persPilot)
)
(:goal
(and
(sub_at subm loc1)
(sub_at subm loc2)
)
)
)
Unfortunately, the following error is returned:
Suspected timeout.
--- OK.
Match tree built with 3 nodes.
PDDL problem description loaded:
Domain: UNNAMED1
Problem: UNDERWATER_PROBLEM
#Actions: 3
#Fluents: 3
Landmarks found: 2
Starting search with IW (time budget is 60 secs)...
rel_plan size: 2
#RP_fluents 2
Caption
{#goals, #UNnachieved, #Achieved} -> IW(max_w)
{2/1/0}:IW(1) -> [2][3][4];; NOT I-REACHABLE ;;
Total time: 2.5e-05
Nodes generated during search: 4
Nodes expanded during search: 4
IW search completed
Starting search with BFS(novel,land,h_add)...
--[4294967295 / 3]--
--[3 / 3]--
--[3 / 1]--
--[2 / 1]--
--[1 / 1]--
Total time: 1.2e-05
Nodes generated during search: 4
Nodes expanded during search: 3
Plan found with cost: 2.8026e-45
BFS search completed
I have no clue what any of this means.
Your goal asks the planner to bring the submarine to two places at once:
If you remove
(sub_at subm loc1)
it should work.