|
The OpenCyc Planner
Version 0.7 |
The OpenCyc Planner is a reimplementation of the SHOP planner designed to directly access the Cyc Inference Engine. A planner is an inference engine optimized for reasoning about actions, events, and other activities in a dynamic world.
Actions are represented as formulas with instances of
(#$cleans #$Bob #$BobsRoomFloor)
this represents the fact that Bob is cleaning the floor of his room in the current context.
One uses the planner by giving it a high-level, possibly abstract action sentence as a goal. For example,
(#$transport #$Bob #$AustinBergstromAirport)
given to the planner as a goal means that it should find a sequence of simple actions for getting Bob to the Austin Bergstrom International Airport.
For any context we shall consider instances of
A plan consists of a linear sequence of sentences, whose operators are
instances of
(#$turnLeftAtIntersection (#$RoadIntersectionFn #$SanJacinto #$SixthStreet)) (#$followHighwayRouteUntilExit #$MopacExpressway #$MopacExit43)
The planner takes as one of its inputs a microtheory that sets the
context for the search. Planner rules using the vocabulary described
above should be asserted in a microtheory that is an instance of
Simple actions can have preconditions. Preconditions are facts that must be true in the world in order for the particular action to be executable or applicable. In order to mop the floor of a room, you must be holding the mop, you must be in or standing next to the room, the floor can't be covered with carpeting, etc. These facts can all be represented with preconditions.
Usage:
(#$preconditionFor-Props CONDITION ACTION)
Comment for
"A binary predicate which relates instances of ELSentence-Assertible to instances of ELSentence-Assertible, and which is used to state that one formula expresses a necessary precondition for the truth of another. (preconditionFor-Props COND PROP) means that PROP isn't true unless COND is true. Preconditions of various types are distinguished by the more specialized predicates legalPreconditionFor and causalPreconditionFor. See also sufficientFor-Props."
Example:
(#$preconditionFor-Props
(#$and (#$isa ?CLEANSER #$CleaningSubstance)
(#$possesses ?AGT ?CLEANSER)
(#$possesses ?AGT ?OBJECT))
(#$cleans ?AGT ?OBJECT))
Simple actions are unique in a domain, since they are permitted to have effects. Effects are facts that are true in the world after an action occurs. We use positive literals to represent facts that are true in the world after the action is executed. We use negative literals to represent facts that are made untrue by the execution of the action.
We use the binary predicate
Usage:
(#$effectOfAction-Props ACTION EFFECTS)
Comment for
"A binary predicate which relates instances of ELSentence-Assertible to instances of ELSentence-Assertible. (effectOfAction-Props ACTION-PROP PROP) means that the effect of ACTION-PROP, where ACTION-PROP is a proposition of the form (PRED . ARGS) and PRED is an instance of ActionPredicate, is PROP, where PROP is any proposition that describes the effect(s) of ACTION-PROP. Thus, effectOfAction-Props should be used only when the first argument is a proposition in which an ActionPredicate is used in the arg0 place."
Example:
(#$effectOfAction-Props (#$cleans ?AGT ?OBJ) (#$not (#$dirtinessOfObject ?OBJ #$ALittleDirty))
Effects can also be conditional, meaning that the facts that are true
after the action occurs may be dependent on what is already true. For
rules like these, we use
Usage:
(#$effectOfActionIf-Props ACTION CONDITION EFFECTS)
Comment for
"A ternary predicate which relates three instances of ELSentence-Assertible. (effectOfActionIf-Props ACTION COND EFFECT) means that if COND is true in the context in which ACTION occurs, then ACTION makes EFFECT true. This predicate was designed to be used in the specification of planning domains (see PlanningDomainMicrotheory). ACTION should be an atomic sentence with an ActionPredicate as the formula operator (i.e. in the arg0 position). See also the binary predicate effectOfAction-Props."
Example: A more subtle notion of cleaning:
(#$effectOfActionIf-Props (#$cleans ?AGT ?OBJ)
(#$and (#$dirtinessOfObject ?OBJ ?OLD-DIRTINESS)
(#$followingValue ?NEW-DIRTYNESS ?OLD-DIRTYNESS))
(#$and (#$not (#$dirtynessOfObject ?OBJ ?OLD-DIRTYNESS))
(#$dirtynessOfObject ?OBJ ?NEW-DIRTYNESS)))
In this example the dirtyness of an object is an instance of
SHOP is an example of a Hierarchical Task Network planner. Most of the knowledge it uses is in the form of method decompositions. Methods encapsulate the approach of solving problems by breaking them down into smaller subproblems. For example, cleaning the floor can be achieved, if it is not carpeted, by mopping the floor . Mopping the floor can be achieved by acquiring a mop and a pail of soapy water, mopping each square meter of the floor separately, and then cleaning the mop and emptying the pail. Mopping each square meter involves wetting the mop, wringing out the mop, swabbing the square meter section, checking to see if it is still dirty, and repeating if necessary. Each of these can be represented as a single method rule in the Cyc KB.
(#$implies FORMULA
(#$methodForAction (COMPLEXACTIONPRED . ARGS)
(#$actionSequence
(#$TheList
(SUBACTION1 )
(SUBACTION2 )
(SUBACTION3 )))))
Usage:
(#$sufficientFor-Props CONDITION-FORMULA ACTION-SENTENCE)
Comment for
"A binary predicate which relates instances of ELSentence-Assertible to instances of
Example:
(#$sufficientFor-Props
(#$dirtynessOfObject ?OBJECT #$Sterile)
(#$cleans ?AGT ?OBJECT))
The OpenCyc Planner is easy to use, it can be accessed with one function: SHOP-FIND-PLANS.
function SHOP-FIND-PLANS: (task mt &optional (verbose 0) number time depth backchain)
Returns a list of action sequences each of which are a plan for TASK in the context of MT.
- TASK
- a formula with an instance of
#$ActionSequence as its first argument.- MT
- a microtheory that gives context to the planning problem.
- VERBOSE
- an integer between 0 and 9, that controls how much logging information shop should send to standard output.
- NUMBER
- the maximum number of plans to return.
- TIME
- the maximum amount of time allocated to the planner.
- DEPTH
- the maximum depth the planner can reach searching for plans.
- BACKCHAIN
- the maximum number of backchains allowed when querying the KB when matching rule conditions.
Here is pretty complete intro guide: http://www.research.salford.ac.uk/plansig/papers/crc-chapter.pdf
CycLish examples describing planning principles:
Nice PowerPoint presentation about SHOP Planner (the type OpenCyc uses): http://prometeo.ing.unibs.it/sschool/slides/nau/nau2.ppt (very pretty and understandable but its examples use the HICAP system)