RuleBasedAgent


A rule based system consists of an inference engine and knowledge base. The engine's reasoning mechanism uses a forward-reasoning technique. The knowledge base contains a fact base and a rule base. The fact base acts as a repository of all the truths that is seen or understood by the agent. Such facts that exist in the fact base are the sensor readings from the agent. At the start of each cycle, the rule-base agent updates the fact base with all of the new sensor readings. The fact base is periodically updated with new sensor data, which triggers the execution of rules. This process ends when the engine returns an appropriate action to the agent.

To reduce the number of rules necessary to determine the behavior of the system, we have decided to choose the atomic actions at a relatively high level of abstraction. For example, a typical rule would have the consequent of movement towards a particular spot. Many additional intermediate rules could have been implemented to determine exactly how to move towards the objective. Instead, once this rule has been fired, a function is called to determine where the objective is and binds various directional parameters of the consequent of the rule. The utilization of these aiding functions reduces the number of intermediate rules that are necessary in the rule base and allows the developer to concentrate on the upper level behavioral aspects of the agent in the rule base.

The ease of modification of the rules also allows the developer to quickly adjust the behavior of the agent. This is primarily done through the change in salient values of each rule. In addition to salient values, the speed, aggressive nature, and other parameters are adjusted to yield an agent with completely different behavior traits without any modification to the main engine of the system or major change to the structure of the rules. The value of this property is that major alterations can be made to the agent's behavior with little modification to the actual structure and knowledge. A result of this is an increase of time dedicated to testing and tuning the agent for performance.
  The rule base of the RuleBasedAgent agent consists of 15 rules. The consequent of each rule may result in another fact pushed onto the fact base or an action of the agent which would terminate the inference mechanism for that simulation cycle. A critical property of each rule is its salience. The salience of the rule is used primarily to aid in conflict resolution as well as the method of sorting in the rule base stack. This method prioritizes the various rules which in turn define the behavior of the agent.

The RuleBasedAgent implements all the five basic commands of the game (movement, feeding, fleeing, attacking and mating). Whenever a decision needs to be taken, it is determined by synthetic facts in the fact base of the agent. For instance, the choice to attack is determined by the fact AGGRESSIVE, while a choice to flee is triggered by the fact TIMID. Whenever there is a potential for an encounter with another agent, the decision of the aggressive or timid behavior is made by the relative energy of the agents.

The rule based agent implements flocking behavior with other rule based agents in its sensor range. If the fact base contains the synthetic fact FLOCK, the move commands will be restricted to movements which allow the agent to remain in the flock. The leader of the flock is the agent with the lowest id (the oldest agent). Two scenarios occur when food is within range while in a flock. If the GREEDY fact exists, the agent attempts to move and acquire the food closest to them. If the fact does not exist, then the agent only attempts to move and acquire a food resource if no other rule-based agent is closer to the resource. The second scenario promotes efficient feeding while in the pack to avoid agents’ ineffective attempts to acquire the same resource. The agents in the pack also synchronize their attack and fleeing behaviors. If the leader of the pack attacks an agent, all the members of the pack will attack, regardless of their energy levels and the aggressiveness ratio.

 
   
Author: Johann Nguyen