Skip to content

Multiple Goals

Yoav Grimland edited this page May 11, 2025 · 3 revisions

Multiple goals are a feature in PDDLSIM that problems can use via the :multiple-goals requirement. While it is possible to specify in PDDL a goal composed of multiple conditions (via and), "multiple goals" allows to specify problems with multiple, separate goal conditions, that must all be achieved, but can be achieved at different times. In essence, they act as a "task list" for the agent.

A simple example with a mueseum

To illustrate using multiple goals in a problem, let's make a domain-problem pair describing visiting different exhibits in a muesuem. Problems will specify different sets of exhibits to see, which, naturally, can be visited in any order. To begin, let's define the relevant domain:

(define (domain mueseum)
        (:requirements :typing :equality :negative-preconditions)
        (:types person exhibit)
        (:predicates (at ?p - person ?e - exhibit))
        (:action visit
         :parameters (?p - person ?from ?to - exhibit)
         :precondition (and (at ?p ?from)
                       (not (= ?from ?to)))
         :effect (and (at ?p ?to)
                      (not (at ?p ?from)))))

With this, let's now define a problem utilizing multiple goals, to specify a mueseum with multiple exhibits, as well as multiple visitors in it, each of them wanting to visit different exhibits:

(define (problem bloomfield)
    (:domain mueseum)
    (:requirements :multiple-goals)
    (:objects lobby
              da-vinci-exhibit
              aerodynamics-exhibit
              automorphia-exhibit
              make-room-exhibit - exhibit
              emily
              bob - person)
    (:init (at bob lobby)
           (at emily lobby))
    (:goals (at emily da-vinci-exhibit)    ; Note the usage of `:goals` here instead of `:goal`
            (at emily aerodynamics-exhibit)
            (at bob make-room-exhibit)
            (at bob automorphia-exhibit)))

As one can see, emily wants to only visit the engineering oriented exhibits, while bob is more interested in architecture. Now, as we try to satisfy both Bob and Emily's requirements, notice how multiple different action sequenes can solve the problem. For example, both of these sequences work:

(visit emily lobby aerodynamics-exhibit)
(visit bob lobby make-room-exhibit)
(visit emily aerodynamics-exhibit da-vinci-exhibit)
(visit bob make-room-exhibit da-vinci-exhibit)
(visit bob da-vinci-exhibit automorphia-exhibit)

and:

(visit bob lobby make-room-exhibit)
(visit bob make-room-exhibit aerodynamics-exhibit)
(visit emily lobby aerodynamics-exhibit)
(visit emily aerodynamics-exhibit da-vinci-exhibit)
(visit bob aerodynamics-exhibit automorphia-exhibit)

despite the different order of actions, and the fact bob visits different exhibits. It is important to note of course, that specifying the goal as:

(:goal (and (at emily da-vinchi-exhibit)
            (at emily aerodynamics-exhibit)
            (at bob make-room-exhibit)
            (at bob automorphia-exhibit)))

would not work! Unfortunately, Bob and Emily cannot be in multiple place at once.

Syntax and semantics

To use "multiple goals" PDDL problems, one must change the normal :goal section to :goals. With that, one can simply add more conditions to the section, which become additional goals, that, as described above, may be completed at any time. In PDDLSIM, one can track the goal completion using SimulationClient.get_reached_goal_indices, and likewise SimulationClient.get_unreached_goal_indices, which return indices into the conditions of the :goals section.

While obvious, it is important to note again that once goals are reached, they cannot be "unreached", and thus goal growth is strictly monotonic.

Clone this wiki locally