An On-Algortihm has refers to an algorithm which does not just receive an input and calculates the fitting output (eg. Input: Goal, Output: Plan) but rather continously reads inputs and reacts with outputs.
That is, we do not directly formulate our plan and instead perform the search “live”. We use a stack containing the objectives to be achieved and start from the current position and introduce the goal objective. The inital goal objective will be requested from the Behavior Model to gibve the AI goals which are conformant with its behavioral parameters. Then in each time step we do the following:
- Can we directly fullfil the current objective with some action? If so, execute that action. Mark the current objective as finished.
- Is it not possible to achieve the current objective as of now but there exists a sub objective which would make the current objective achievable? Introduce this sub objective and make it our new current objective.
- Are we unable to do anything to get closer to achieving our goal?
- Should the objective not have been completed within the time limit, mark the current objective a failed and make pop it from the stack.
Note that using a stack for achieving our objectives limits the planning capabilities. In traditional partial-order planning achieving a state of the form “Goal A AND Goal B” is complicated because we cant just first achieve Goal A and then Goal B. After all, we may no longer satisfy goal A after achieving Goal B.
This is why we need to be critical when introducing new sub objectives or executing an action to achieve a sub objective. We must always inquire the entire stack if this new objective/action is conformant with all lower objectives.
The following example demonstrates how the AI may reason with this kind of approach and how the interaction between the Planning Model and the Behavior Model looks like.
The AI attempts to formulate a plan to expand its number of holdings, however, while trying to make money to stock up the troops, it realized that it cannot realize the goal and eventually the objective times out.
From here on the AI must reevaluate whether the objective to expand the army should still be pursued or if it should be popped from the stack. Fo example, the target X may have by now lost troops due to another war and a declaration of war at this point of time might befeasable.