uchicago.src.repastdemos.neural
Class NeuralModel

java.lang.Object
  extended by uchicago.src.sim.engine.SimModelImpl
      extended by uchicago.src.sim.engine.SimpleModel
          extended by uchicago.src.repastdemos.neural.NeuralModel
All Implemented Interfaces:
DescriptorContainer, SimEventProducer, SimModel
Direct Known Subclasses:
NeuralModelFromFile

public class NeuralModel
extends SimpleModel

This demo illustrates the use of the neural network package in an agent. The premise of this model is that there is an office with numerous employees and two bosses. Every tick of the model the bosses may or may not tell each employee to do something. Each employee then is to either perform some task or not depending on the tasks given to them by the bosses. After that the actions of the employee are judged by a consultant.

If an employee does not receive any command for a tick, the consultant will expect the emplyee to perform no tasks. If an employee receives one command from a boss, the employee should perform that task. If an employee receives a command from each boss, since the employee cannot perform multiple tasks she is to not perform the wrong taks and just do nothing. Encoding this results in (Doing nothing = 0, doing something = 1):

receive no command (0, 0) do nothing (0)
receive one command (0, 1) or (1, 0) do something (1)
receive two commands (1, 1) do nothing

In other words the employee has to perform an XOR function.

If the employee performs the wrong action she is scolded by the consultant and her brain (neural network) is trained to not perform the action again.

When an employee performs the correct action she moves towards the center of the display.

Version:
$Revision: 1.1 $ $Date: 2005/08/12 20:04:54 $
Author:
Jerry Vos

Field Summary
protected  Office office
           
protected  int officeHeight
           
protected  int officeWidth
           
 
Fields inherited from class uchicago.src.sim.engine.SimpleModel
agentList, autoStep, isGui, name, params, schedule, seed, shuffle, startAt
 
Fields inherited from class uchicago.src.sim.engine.SimModelImpl
descriptors, modelManipulator
 
Constructor Summary
NeuralModel()
           
 
Method Summary
 void begin()
          Begins a simulation run.
protected  void buildDisplay()
          This builds the display surface for the office
protected  void buildGraphs()
          This builds the error graphs.
 int getEmployeeCount()
           
 java.lang.String[] getInitParam()
          Gets the names of the initial model parameters to set.
 java.lang.String getName()
          Gets the name of this model.
 int getOfficeHeight()
           
 int getOfficeWidth()
           
static void main(java.lang.String[] args)
           
protected  void postStep()
           
protected  void preStep()
           
 void setEmployeeCount(int employeeCount)
           
 void setOfficeHeight(int officeHeight)
           
 void setOfficeWidth(int officeWidth)
           
 void setup()
          Sets up the model for the next run, clears out all the old employees and the old displays
protected  void step()
           
 
Methods inherited from class uchicago.src.sim.engine.SimpleModel
atEnd, atPause, buildModel, buildSchedule, getNextDoubleFromTo, getNextIntFromTo, getSchedule, run, runAutoStep, setRngSeed, setStoppingTime, setStoppingTime
 
Methods inherited from class uchicago.src.sim.engine.SimModelImpl
addPropertyListener, addSimEventListener, clearMediaProducers, clearPropertyListeners, fireBooleanPropertyEvent, fireEndSim, fireNumericPropertyEvent, fireObjectPropertyEvent, firePauseSim, fireSimEvent, fireStopSim, fireStringPropertyEvent, generateNewSeed, getController, getMediaProducers, getModelManipulator, getParameterDescriptors, getPropertiesValues, getRngSeed, getTickCount, pause, registerDisplaySurface, registerMediaProducer, removePropertyListener, removeSimEventListener, setController, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

office

protected Office office

officeWidth

protected int officeWidth

officeHeight

protected int officeHeight
Constructor Detail

NeuralModel

public NeuralModel()
Method Detail

getInitParam

public java.lang.String[] getInitParam()
Description copied from interface: SimModel
Gets the names of the initial model parameters to set. These names must have get and set methods supplied by the model. For example, for the parameter maxAge, the model must have getMaxAge and setMaxAge methods.

Specified by:
getInitParam in interface SimModel
Overrides:
getInitParam in class SimpleModel
Returns:
a String[] of the initial parameter names

begin

public void begin()
Description copied from interface: SimModel
Begins a simulation run. All initialization, building the model, diplay, etc. should take place here. This method is called whenever the start button (or the step button if the run has not yet begun) is clicked. If running in batch mode this is called to kick off a new simulation run.

Specified by:
begin in interface SimModel
Overrides:
begin in class SimpleModel

buildDisplay

protected void buildDisplay()
This builds the display surface for the office


buildGraphs

protected void buildGraphs()
This builds the error graphs.


setup

public void setup()
Sets up the model for the next run, clears out all the old employees and the old displays

Specified by:
setup in interface SimModel
Overrides:
setup in class SimpleModel

preStep

protected void preStep()
Overrides:
preStep in class SimpleModel

step

protected void step()
Overrides:
step in class SimpleModel

postStep

protected void postStep()
Overrides:
postStep in class SimpleModel

getName

public java.lang.String getName()
Description copied from class: SimpleModel
Gets the name of this model.

Specified by:
getName in interface SimModel
Overrides:
getName in class SimpleModel
Returns:
the name of the model/simulation

getEmployeeCount

public int getEmployeeCount()
Returns:
Returns the number of employees in the office.

setEmployeeCount

public void setEmployeeCount(int employeeCount)
Parameters:
employeeCount - The number of employees in the office.

getOfficeHeight

public int getOfficeHeight()
Returns:
returns the officeHeight

setOfficeHeight

public void setOfficeHeight(int officeHeight)
Parameters:
officeHeight - the officeHeight

getOfficeWidth

public int getOfficeWidth()
Returns:
returns the officeWidth

setOfficeWidth

public void setOfficeWidth(int officeWidth)
Parameters:
officeWidth - the officeWidth

main

public static void main(java.lang.String[] args)