This repository has been archived on 2023-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
plasp/doc/output-format.md

3.1 KiB
Raw Blame History

Output Format

plasp 3 translates SAS and PDDL files into a uniform ASP fact format.

Overview

Essentially, plasps output format consists of variables that are modified by actions whose preconditions are fulfilled.

plasps variables correspond to the multivalued variables in SAS. PDDL predicates are turned into Boolean variables to make the output format consistent.

Actions are modeled exactly as PDDL actions and SAS operators.

In a Nutshell

The following illustrates plasps output format for the problem of turning switches on and off.

% declares the type "type(switch)"
type(type(switch)).

% introduces a switch "constant(a)"
constant(constant(a)).
has(constant(a), type(switch)).

% declares a variable "variable(on(X))" for switches X
variable(variable(on(X))) :- has(X, type(switch)).

% the variable may be true or false
contains(variable(on(X)), value(on(X)), true)) :- has(X, type(switch)).
contains(variable(on(X)), value(on(X)), false)) :- has(X, type(switch)).

% declares the action "action(turnOn(X))", which requires switch X to be off and then turns it on
action(action(turnOn(X))) :- has(X, type(switch)).
precondition(action(turnOn(X)), variable(on(X)), value(on(X), false)) :- has(X, type(switch)).
postcondition(action(turnOn(X)), effect(0), variable(on(X)), value(on(X), true)) :- has(X, type(switch)).

% initially, the switch is off
initialState(variable(on(constant(a))), value(on(constant(a)), false)).

% in the end, the switch should be on
goal(variable(on(constant(a))), value(on(constant(a)), true)).

Syntax and Semantics

plasp structures the translated ASP facts into multiple sections, which are explained in the following.

Feature Requirements

% declares a required feature
requires(feature(<name>)).

plasp recognizes and declares advanced features used by the input problem, such as conditional effects and axiom rules (currently only SAS). See the full list of supported features for more information.

The feature requirement predicates may be used in meta encodings to warn about unsupported features.

Types

% declares a <type>
type(type(<name>)).

% specifies <object> to be of type type(<name>)
has(<object>, type(<name>)).

Variables, constants, and objects may be typed. Types are only available with PDDL and if typing is enabled.

Variables

% declares a <variable>
variable(variable(<name>)).

% adds a <value> to the domain of a <variable>
contains(<variable>, <value>).

With SAS, variable names are numbers starting at 0, variable(<number>). SAS variables are inherently multivalued, which results in two or more values of the form value(<SAS predicate>, <bool>) for each variable.

With PDDL, Boolean variables are created from the PDDL predicates. Variables ared named after the PDDL predicates, variable(<PDDL predicate>). Each variable contains exactly two values (one true, one false) of the form value(<PDDL predicate>, <bool>). Note that with PDDL, variables and values are named identically.