ThreadIntermediary

public class ThreadIntermediary implements Runnable

An intermediary allowing for the trading of states and actions between the agent and the environment.

Author:The Condor

Constructors

ThreadIntermediary

public ThreadIntermediary(Agent associatedAgent)

Methods

retrieveActions

public synchronized Map<Integer, Action> retrieveActions()

retrieveState

public synchronized ViewAndNextLatch retrieveState()

Get the current state and a latch to await for the next state.

Returns:A structure with a StateView and a CountDownLatch. The former is null when no state was set before.

run

public void run()

submitActions

public synchronized void submitActions(Map<Integer, Action> actions)

submitState

public synchronized CountDownLatch submitState(StateView stateView, HistoryView historyView, StateType stateType)

Submit a state and its type, receiving a latch for the agent’s action.

Parameters:
  • stateView
  • stateType
Returns:

A latch whose countdown indicates that the agent has responded with an action.