jLOAF: How to set it up - NMAI-lab/JLOAF GitHub Wiki

Creating an Agent in a chosen domain.

  1. Subclass the Agent class.

  2. Subclass the ComplexInput or AtomicInput class.

  3. Subclass the ComplexAction or AtomicAction class.

  4. Create a LogFile2CaseBase class.

(Optional)

  1. Subclass Perception

  2. Sublcass MotorControl

Agent Class

  • Implement the run method: This method should call the selectAction(Input input) method on the reasoning object. Remember to cast the returned action to AgentAction.
  • Implement train method: Currently does nothing since, the Case Base is passed to the reasoner separately.

Input Class

  • Extend ComplexInput if there are many features.
  • Extend AtomicInput if there is only one feature.
  • Call Super Class constructor with name and similarity.
  • Ensure Serialize ID exists

Action Class

  • Extend ComplexInput if there are many features. Extend AtomicInput if there is only one feature.
  • Call Super Class constructor with name
  • Ensure Serialize ID exists

LogFile2CaseBase

This converts the agent traces into a specified Complex or Atomic input and action structure. This structure is decided by the user. For example:- There can be a ComplexInput called BallInput that has two AtomicInputs called BallDirection and BallDistance. Or there can be AtomicInput called ballDirection. CompelxInputs can also be nested in ComplexInputs. Generally there is one overall AgentInput called SoccerInput which is a ComplexInput which holds all the other ComplexInputs relating to specific things on the field like the ball, the goal, the players etc.

Similarly the actions can have either one feature or multiple. Foe example the Kick action has two features, the direction and the power. The turn action only has one feature: angle.

Once the input-action pair for each moment in time is converted into the AgentInputs and AgentActions, they must be added to a case. This is done using createThenAdd(Input input, Action action, StateBasedSimilarity) which is a method in the CaseBase class. This creates a stateBasedInput which contains all the past cases until this point in time. This stateBasedInput will be put inside the specified caseBase. For examples please refer to RoboCup and Vacuum Cleaner.

Ideally it should take the name of the logFile and the name of the saved CaseBase. Once it has created the caseBase it should save it using the save() method.

Perception and MotorControl

Perception is used when a perception of the environment has to be converted into an Input. This can be used when the agent is interacting with an environment and is running in real time.

MotorControl also is to do with how the agent may have to interact with the environement. If the action that it outputs is a string, MotorControl is responsible for converting that string into something the environment can understand.

For testing performance purposes, these two are not used since there is no active environment.