lnsc.page
Class SingleAgentEnvironment

java.lang.Object
  |
  +--java.util.Observable
        |
        +--lnsc.page.AbstractObservableEnvironment
              |
              +--lnsc.page.SingleAgentEnvironment
All Implemented Interfaces:
Environment

public class SingleAgentEnvironment
extends AbstractObservableEnvironment

Run a single agent environement for a given number of step or until success.

The reward given to the agent after each action can be either, based on the action cost (-), the resulting state value (+), or given values for normal and goal-leading (an action leading to a final state) action, or any addition of these options.

The state should generate a single state in returns of an action (hence technically have isDeterministic = true), not multiple like in a search procedure. It should also return a single observable state on request (wich may be the state itself) and not many (since there is a single agent.

Agents may requires the observable state to provide actions in a specific format. But the observable state does not need to implement getNextStates, or getObservableStates, nor does the State need to implement getActions or getActionsEnumerator.

If there are obervers, a toDataSet description of each state is sent to them initially, and after the processing of every action (e.i. after State.getNextStates(lnsc.page.Action)).


Field Summary
 boolean showDots
          Indicates whether or not to output dots every 1000 steps.
 
Constructor Summary
SingleAgentEnvironment(boolean costReward, boolean valueReward, double newReward, double newSuccessReward, int newMaxSteps)
          Constructs a server for a single agent specifying all reward details.
SingleAgentEnvironment(boolean costReward, boolean valueReward, int newMaxSteps)
          Constructs a server for a single agent with action or state based reward.
SingleAgentEnvironment(double newReward, double newSuccessReward, int newMaxSteps)
          Constructs a server for a single agent with specific rewards.
 
Method Summary
 double[] go(Agent agent, State initState)
          Run an agent on the task once.
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

showDots

public boolean showDots
Indicates whether or not to output dots every 1000 steps. Default is true.

Constructor Detail

SingleAgentEnvironment

public SingleAgentEnvironment(boolean costReward,
                              boolean valueReward,
                              double newReward,
                              double newSuccessReward,
                              int newMaxSteps)
Constructs a server for a single agent specifying all reward details.

Parameters:
costReward - Reward -= Action.Cost (if true)
valueReward - Reward += ResultingState.Value (if true)
newReward - Normal action reward.
newSuccessReward - Successful (goal-leading) action reward.
newMaxSteps - Maximum number of steps.

SingleAgentEnvironment

public SingleAgentEnvironment(boolean costReward,
                              boolean valueReward,
                              int newMaxSteps)
Constructs a server for a single agent with action or state based reward.

Parameters:
costReward - Reward -= Action.Cost (if true)
valueReward - Reward += ResultingState.Value (if true)
newMaxSteps - Maximum number of steps.

SingleAgentEnvironment

public SingleAgentEnvironment(double newReward,
                              double newSuccessReward,
                              int newMaxSteps)
Constructs a server for a single agent with specific rewards.

Parameters:
newReward - Normal action reward.
newSuccessReward - Successful (goal-leading) action reward.
newMaxSteps - Maximum number of steps.
Method Detail

go

public double[] go(Agent agent,
                   State initState)
Run an agent on the task once.

Parameters:
agent - The agent to run on the task.
initState - Optional initial state.
Returns:
Number of step required, total action cost, total reward.