org.jactr.tools.goalfeeder
Class GoalFeeder<T>

java.lang.Object
  extended by org.jactr.tools.goalfeeder.GoalFeeder<T>

public abstract class GoalFeeder<T>
extends java.lang.Object

The goal feeder is a support class to facilitate bridging experiments and models. This is to be used when your experiment cannot directly control the clock, or does not use common reality (which, if it did, it would have control of the clock).

It has a few elements: the goal feeder, goal constructors, goal responders, and respond action.

The goal feeder collects constructors and responders. it is responsible for inserting new goals into the model's goal buffer in response to some experimental component. The actual goal chunk is built by the goal constructor, using the experimental task.

When a model executes the respond action, the contents of the goal buffer are passed to the goal responders and one of them actually executes the specific response

The respond action expects that the goal feeder be attached to the runtime application data.

It is up to the modeler to ensure that nextGoal() is called. The idea is that the experiment will have some listener type interface, when a task is started, the listener will receive the notification and then fire nextGoal().

Where you really need to think is in the area of time control. Since the experiment does not control the clock, the model can run at break-neck speed before the experiment actually gets going. The solution to this is to use BlockingTimedEvents. These are inserted with each call to nextGoal(), the goal constructor can control how much time is permitted to elapse before the model is explicitly blocked to allow the experiment to catch up.

If your model just stops dead in its tracks, it's most likely because a goal constructor returned 0 for the maxTimeElapse when it should have returned something greater

Author:
harrison

Constructor Summary
GoalFeeder(org.jactr.core.model.IModel model, boolean throwExceptionOnInvalidResponse)
          will call assembleConstructors, responders.
 
Method Summary
 void done()
          called when there is nothing left to do
 IGoalInjector<T> getInjector(T experimentTask)
          return the goal constructor that may be able to build a goal chunk for this task
 org.jactr.core.model.IModel getModel()
           
 org.jactr.core.chunk.IChunk nextGoal(T experimentTask)
          Bug: currently will always return null until some more refactoring is done
 void respond(org.jactr.core.production.IInstantiation instantiation)
          generate a response given this goal chunk
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GoalFeeder

public GoalFeeder(org.jactr.core.model.IModel model,
                  boolean throwExceptionOnInvalidResponse)
will call assembleConstructors, responders. if block initially is true, an initial blocking timed event will be inserted to prevent the model from running beyond the first nextGoal call

Parameters:
model -
blockInitially -
Method Detail

done

public void done()
called when there is nothing left to do


getModel

public org.jactr.core.model.IModel getModel()

getInjector

public IGoalInjector<T> getInjector(T experimentTask)
return the goal constructor that may be able to build a goal chunk for this task

Parameters:
experimentTask -
Returns:
can be null

nextGoal

public org.jactr.core.chunk.IChunk nextGoal(T experimentTask)
Bug: currently will always return null until some more refactoring is done

Parameters:
experimentTask -
Returns:
the goal chunk created and set or null

respond

public void respond(org.jactr.core.production.IInstantiation instantiation)
generate a response given this goal chunk

Parameters:
chunk -