4 The Hash State Representation
In the hash state representation, the world is represented by a hash table. Actions and goals are represented by hash actions and hash conditions.
4.1 Hash Actions
(require planning/hash/action) | package: planning |
A hash action is an action on hash tables. Hash actions have several components, broadly grouped into preconditions and effects. The preconditions of a hash action are:
A multidict of requirements. For each key and set of values in this multidict, the hash table must have a mapping from the key to one of the corresponding values. This can be used to express preconditions where many possible values for a key are allowed.
For example, a videogame with the action "destroy the object at space A4" might have the requirements "space A4 must contain a rock, a cracked wall, or an enemy." These requirements would be modeled as a multidict mapping the A4 space to each of the three destructible objects.
A set of required keys. The hash table must contain a mapping for each of these keys, but it does not matter what value the key is mapped to.
A set of required values. The hash table must contain at least one copy of each required value, but it does not matter which key (or keys) the hash table maps to the value.
A multidict of obstructions. For each key and set of values in this multidict, the hash table must not contain a mapping from that key to any of the corresponding values. This can be used to express preconditions where a key may be present, but only if it’s not mapped to certain values.
A set of obstructing keys. The hash table must not contain any of these keys, regardless of what values they map to.
A set of obstructing values. The hash table must not contain any of these values, regardless of what keys are mapped to them.
All of a hash action’s preconditions must be satisfied for the action to be applicable. In that case, the effects of applying the action are defined by:
A hash table of additions, whose entries are added to the hash begin acted upon. If the acted-upon hash already contains a mapping for any of the added keys, those mappings are overwritten.
A set of deletions, containing keys that are removed from the hash table being acted upon. Attempting to delete keys that do not exist in the hash table is not an error, and makes no changes to the hash table.
procedure
(hash-action? v) → boolean?
v : any/c
procedure
(hash-action [ #:requirements requirements #:required-keys required-keys #:required-values required-values #:obstructions obstructions #:obstructing-keys obstructing-keys #:obstructing-values obstructing-values #:additions additions #:deletions deletions]) → hash-action? requirements : multidict? = empty-multidict required-keys : set? = empty-set required-values : set? = empty-set obstructions : multidict? = empty-multidict obstructing-keys : set? = empty-set obstructing-values : set? = empty-set additions : immutable-hash? = empty-hash deletions : set? = empty-set
procedure
(hash-action-requirements action) → multidict?
action : hash-action?
procedure
(hash-action-required-keys action) → set?
action : hash-action?
procedure
(hash-action-required-values action) → set?
action : hash-action?
procedure
(hash-action-obstructions action) → multidict?
action : hash-action?
procedure
(hash-action-obstructing-keys action) → set?
action : hash-action?
procedure
(hash-action-obstructing-values action) → set?
action : hash-action?
procedure
(hash-action-additions action) → immutable-hash?
action : hash-action?
procedure
(hash-action-deletions action) → set?
action : hash-action?
4.2 Hash Conditions
(require planning/hash/condition) | package: planning |
A hash condition is a condition in the hash state representation.
procedure
(hash-condition? v) → boolean?
v : any/c
4.3 Hash Planning Problems
(require planning/hash/problem) | package: planning |
A hash planning problem is a combination of a hash table representing an initial state, a set of hash actions, and a goal hash condition. A solution to the problem is a list of actions to perform that will transform the hash table into a hash table that satisfies the goal condition.
procedure
v : any/c