For sequential execution of a series of actions, G2 performs each statement in the order in which it appears. Thus the following three statements, executed sequentially, swap the values of
var1 and var2:
conclude that var0 = var1;
conclude that var1 = var2;
conclude that var2 = var0;
conclude that var1 = var2;
conclude that var2 = var1;
var2 to both var1 and var2, which would happen if G2 executed the same statements sequentially. The order in which G2 executes actions in parallel after evaluating their arguments is not predictable: G2 may order their execution as needed to optimize scheduling.
do in parallel statement, as described under do in parallel.
Executing Actions in Other Contexts
In rules, action buttons, and user menu choices, parallel execution is the default. Actions in a series therefore execute in parallel unless they are qualified by an in order clause, as described under Specifying Sequential Execution.
Executing Iterative Actions
Sequential or parallel execution can also occur in the execution of a single action. If an action iterates over a class of items, such as:
conclude that the pressure-status of every tire T is full
tire) and executes the action for each item it finds. If the action exists in a context where sequential execution applies, G2 applies the actions to the items sequentially. If the context specifies parallel execution, G2 applies the actions to all of the items in parallel.For more information about parallel and sequential execution within rules, see Understanding Rule Invocation and Execution.
Further Information
The principles that govern the use of actions in rules apply to their use generally, as described in Chapter 23, Rules, Inferencing, and Chaining. For further information about specifying actions, see in that chapter: