Exercise 11.7

Some of the operations in standard programming languages can be modeled as actions that change the state of the world. For example, the assignment operation changes the contents of a memory location, and the print operation changes the state of the output stream. A program consisting of these operations can also be considered as a plan, whose goal is given by the specification of the program. Therefore, planning algorithms can be used to construct programs that achieve a given specification.

  1. Write an action schema for the assignment operator (assigning the value of one variable to another). Remember that the original value will be overwritten!

  2. Show how object creation can be used by a planner to produce a plan for exchanging the values of two variables by using a temporary variable.

View Answer