210 likes | 413 Views
Reactive Approach. CIS 488/588 Bruce R. Maxim UM-Dearborn. Reactive. For reactive AI the output is always the same for a given input (deterministic) Its behavior is completely predictable for a specific situation
E N D
Reactive Approach CIS 488/588 Bruce R. Maxim UM-Dearborn
Reactive • For reactive AI the output is always the same for a given input (deterministic) • Its behavior is completely predictable for a specific situation • Nondeterministic reactive AI would require the addition of memory so that it current action could depend on its state and the current input (and even its last action in this state if you wish)
Planning Basics • Planning is particularly desirable when a problem domain has a well-defined set of operators and easily determined states • Often times accomplishing a task is reduced to asking “which operators can be used?” • It is wise to pick operators that move you closest to your goal
Basics • If there are obstacles the task is modified to become “how do we remove obstacles?” • Result of planning will be a plan in which the task accomplishing every goal has been reduced to a list of primitive operators • Often times planning and executive are interleaved
Problem Reduction • Technique for achieving goals in a problem space by generating and achieving subgoals • When presented with a problem the problem reducer will need to find a plan to solve the problem • Finding a plan might be thought of as being a type of “heuristic search” in which the operators add detail by attaching plans for goals and coordinating steps
Problem Reduction • Coordination involves • Choosing harmonious plans for simultaneous subgoals • Choosing the order of execution for subplans • Good for top-level • Limitation of problem reduction is that it does not always take subplan interactions into account
Algorithm • Initialize graph to starting node • Loop until starting node is solved or until cost exceeds futility • Traverse graph using current best path and keep track of nodes on path not solved or not yet expanded • Pick an unexpanded node • if no successor then assign futility as node value • else add node successors to graph and estimate value of node f(x) = y(x) + h’(x) // h’ is underestimator note: nodes where h'(x) = 0 are solved • Update f'(x) of newly expanded node based on successor values
Problem Reduction • Advantage • Trades the old problem of finding an operator sequence (e.g. a path through states) for the new problem of coordinating operator sequences • Disadvantage • Requires more domain knowledge than heuristic search
Problem Reduction • May require a large number of plans and the plans themselves may be large • Particularly useful if problem space can be represented as an and/or graph • Recall that and/or graphs are useful in answering how and why questions
And/Or Tree Goal: Acquire TV Steal TV Buy TV and Earn Money Get Job
Problem Reduction • Important to make plan finding phase as efficient as possible • How are plans/operators found? • Preconditions • Post conditions • Good candidate for top level program since it combines general plan coordination techniques with library of specific plans
Planning in Games • Plans can be built in a reactive manner • Pathfinding in uneven terrain is best done with planning techniques that search for the best available path • Pathfinding requires a world map and lots of storage • Reactive pathfinding would take longer, might not find the optimal path, but would use far less storage (only local terrain information is needed)
Reactive Substitutes for Planning • There are very few cases in games where planning is necessary • Reactive strategies may appear very complex when used for high level tactical decisions • Obstacle avoidance could be viewed handled reactively as long as the agent avoids getting stuck
Reactive DeterministicGame Techniques • Scripts (small programs used to compute a result given some input parameters • Rule-based systems (collections of if..then rules used to manipulate variables) • Finite-state machines (select next state action based on current input values)
Reactive Advantages for Animats • Embodiment (reactive behaviors based on interpreting local information to select actions) • Learning (many learning techniques are based on acquiring reactive mappings between inputs and behavior)
Architectures • Components are best viewed as black boxes with details of AI unknown to its users • Architectural Styles • Monolithic (single component architecture) • Flat (many components exist in parallel) • Hierarchical (components nested inside one another) • Reducing complexity is the deciding factor used to select an architectural style
Game AI Decomposition • Structural • Splits solution according to the function (movement, weapon handling) of each component • Behavioral • Based on system activities or modes (hunting, fleeing, collecting ammo) different component for each behavior (very appropriate for computer games) • Goal • Create goal trees to assist in decision making
Component Connection TypesAttribution • Independent sum (components connected to different outputs to avoid conflicts) • Combination (outputs from different components blended together to make final result) • Suppression (strong components get priority weak components ignored) • Sequential attribution (arbitration used to ensure output of different components over time – fair scheduling)
Example - 1 • Subsumation • Horizontal, hierarchical layers • Higher layer outputs over ride lower layer outputs • Behavior-based decomposition • Uses flat organization • Output suppression
Example - 2 • Voting system • Set of distributed components connected to a smaller vote counting component • Output with the most votes wins • Uses functional decomposition • Flat organization • Combination used to merge outputs