public class EnvironmentServer extends java.lang.Object implements EnvironmentServerInterface, EnvironmentDelegation
EnvironmentServerInterface implementation that delegates all Environment interactions and request
to a provided Environment delegate. This class will also
intercept all interactions through the executeAction(burlap.oomdp.singleagent.GroundedAction) and
resetEnvironment() methods
and tell all EnvironmentOutcome instances registered with this server
about the event.| Modifier and Type | Class and Description |
|---|---|
static class |
EnvironmentServer.StateSettableEnvironmentServer |
EnvironmentDelegation.EnvDelegationTools| Modifier and Type | Field and Description |
|---|---|
protected Environment |
delegate
the
Environment delegate that handles all primary Environment
functionality. |
protected java.util.List<EnvironmentObserver> |
observers
The
EnvironmentObserver objects that will be notified of Environment
events. |
| Constructor and Description |
|---|
EnvironmentServer(Environment delegate,
EnvironmentObserver... observers) |
| Modifier and Type | Method and Description |
|---|---|
void |
addObservers(EnvironmentObserver... observers)
Adds one or more
EnvironmentObservers |
void |
clearAllObservers()
Clears all
EnvironmentObservers from this server. |
static EnvironmentServer |
constructor(Environment delegate,
EnvironmentObserver... observers)
Constructs an
EnvironmentServer or EnvironmentServer.StateSettableEnvironmentServer,
based on whether the input delegate implements StateSettableEnvironment. |
static EnvironmentServerInterface |
constructServerOrAddObservers(Environment env,
EnvironmentObserver... observers)
If the input
Environment is an instance EnvironmentServerInterface,
then all the input observers are added to it and it is returned. |
EnvironmentOutcome |
executeAction(GroundedAction ga)
Executes the specified action in this environment
|
State |
getCurrentObservation()
Returns the current observation of the environment as a
State. |
Environment |
getEnvironmentDelegate()
Returns the
Environment delegate that handles all Environment
functionality |
double |
getLastReward()
Returns the last reward returned by the environment
|
java.util.List<EnvironmentObserver> |
getObservers()
Returns all
EnvironmentObservers registered with this server. |
boolean |
isInTerminalState()
Returns whether the environment is in a terminal state that prevents further action by the agent.
|
void |
removeObservers(EnvironmentObserver... observers)
Removes one or more
EnvironmentObservers from this server. |
void |
resetEnvironment()
Resets this environment to some initial state, if the functionality exists.
|
void |
setEnvironmentDelegate(Environment delegate)
Sets the
Environment delegate that handles all Environment functionality |
protected Environment delegate
Environment delegate that handles all primary Environment
functionality.protected java.util.List<EnvironmentObserver> observers
EnvironmentObserver objects that will be notified of Environment
events.public EnvironmentServer(Environment delegate, EnvironmentObserver... observers)
public static EnvironmentServerInterface constructServerOrAddObservers(Environment env, EnvironmentObserver... observers)
Environment is an instance EnvironmentServerInterface,
then all the input observers are added to it and it is returned. Otherwise, a new EnvironmentServer
is created around it, with all of the observers added.env - the Environment that will have observers added to itobservers - the EnvironmentObserver objects to add.Environment or an EnvironmentServer.public static EnvironmentServer constructor(Environment delegate, EnvironmentObserver... observers)
EnvironmentServer or EnvironmentServer.StateSettableEnvironmentServer,
based on whether the input delegate implements StateSettableEnvironment.delegate - the delegate Environment for most environment interactions.observers - the EnvironmentObserver objects notified of Environment events.EnvironmentServer or EnvironmentServer.StateSettableEnvironmentServer.public Environment getEnvironmentDelegate()
Environment delegate that handles all Environment
functionalitygetEnvironmentDelegate in interface EnvironmentDelegationEnvironment delegatepublic void setEnvironmentDelegate(Environment delegate)
Environment delegate that handles all Environment functionalitysetEnvironmentDelegate in interface EnvironmentDelegationdelegate - the Environment delegatepublic void addObservers(EnvironmentObserver... observers)
EnvironmentObserversaddObservers in interface EnvironmentServerInterfaceobservers - and EnvironmentObserverpublic void clearAllObservers()
EnvironmentObservers from this server.clearAllObservers in interface EnvironmentServerInterfacepublic void removeObservers(EnvironmentObserver... observers)
EnvironmentObservers from this server.removeObservers in interface EnvironmentServerInterfaceobservers - the EnvironmentObservers to remove.public java.util.List<EnvironmentObserver> getObservers()
EnvironmentObservers registered with this server.getObservers in interface EnvironmentServerInterfaceEnvironmentObservers registered with this server.public State getCurrentObservation()
EnvironmentState.getCurrentObservation in interface EnvironmentState.public EnvironmentOutcome executeAction(GroundedAction ga)
EnvironmentexecuteAction in interface Environmentga - the GroundedAction that is to be performed in this environment.public double getLastReward()
EnvironmentgetLastReward in interface Environmentpublic boolean isInTerminalState()
EnvironmentisInTerminalState in interface Environmentpublic void resetEnvironment()
EnvironmentresetEnvironment in interface Environment