public class RLGlueAgentShell
extends java.lang.Object
implements org.rlcommunity.rlglue.codec.AgentInterface
Modifier and Type | Class and Description |
---|---|
protected class |
RLGlueAgentShell.MutableInt
A mutable int wrapper
|
protected class |
RLGlueAgentShell.MutableState
A mutable OO-MDP state wrapper
|
protected class |
RLGlueAgentShell.RLGlueRF
A reward function for returning the last RLGlue reward.
|
protected class |
RLGlueAgentShell.RLGlueTF
A termianl function that returns true when the last RLGlue state was terminal.
|
Modifier and Type | Field and Description |
---|---|
protected RLGlueLearningAgentFactory |
buralpAgentFactory
The BURALP learning agent factor
|
protected LearningAgent |
burlapAgent
The BURLAP learning agent that is being used.
|
protected java.lang.Thread |
burlapThread
The thread in which the current BURLAP learning algorithm thread is running
|
protected int |
debugCode
Debug code used for printing debug information.
|
protected Domain |
domain
The BURLAP domain that wraps the RLGlue environment
|
protected RLGlueWrappedDomainGenerator |
domainGenerator
The BURLAP domain generator which can take as input an RLGlue task spec and produce a corresponding domain.
|
protected double |
lastReward
The last reward returned by RLGlue
|
protected boolean |
lastStateIsTerminal
Whether the last state was a terminal state
|
protected RLGlueAgentShell.MutableInt |
nextAction
Maintains the current RLGlue action to be performed.
|
protected RLGlueAgentShell.MutableState |
nextState
Maintains the state received from RLGlue
|
protected boolean |
printDebug
Whether to print debug statements.
|
Constructor and Description |
---|
RLGlueAgentShell(RLGlueLearningAgentFactory burlapAgentFactory)
Initializes an RLGlue agent to use a BURLAP agent that will be generated from the specified factory.
|
Modifier and Type | Method and Description |
---|---|
State |
actionCall(int actionId)
This method is called by the BURLAP actions and interfaces the action results and state return with RLGlue
|
void |
agent_cleanup() |
void |
agent_end(double arg0) |
void |
agent_init(java.lang.String arg0) |
java.lang.String |
agent_message(java.lang.String arg0) |
org.rlcommunity.rlglue.codec.types.Action |
agent_start(org.rlcommunity.rlglue.codec.types.Observation arg0) |
org.rlcommunity.rlglue.codec.types.Action |
agent_step(double arg0,
org.rlcommunity.rlglue.codec.types.Observation arg1) |
void |
loadAgent()
Loads this agent into RLGlue using the default host and port.
|
void |
loadAgent(java.lang.String hostAddress,
java.lang.String portString)
Loads this agent into RLGlue using the specified host address and port.
|
void |
toggleDebug(boolean printDebug)
Toggles whether debug information should be printed
|
protected int debugCode
protected final RLGlueAgentShell.MutableInt nextAction
protected final RLGlueAgentShell.MutableState nextState
protected RLGlueLearningAgentFactory buralpAgentFactory
protected Domain domain
protected RLGlueWrappedDomainGenerator domainGenerator
protected LearningAgent burlapAgent
protected double lastReward
protected boolean lastStateIsTerminal
protected java.lang.Thread burlapThread
protected boolean printDebug
public RLGlueAgentShell(RLGlueLearningAgentFactory burlapAgentFactory)
burlapAgentFactory
- the BURLAP learning agent factory to usepublic void loadAgent()
public void loadAgent(java.lang.String hostAddress, java.lang.String portString)
hostAddress
- the RLGlue host address.portString
- the port on which to connect to RLGlue.public void toggleDebug(boolean printDebug)
printDebug
- whether to print debug logs or notpublic void agent_cleanup()
agent_cleanup
in interface org.rlcommunity.rlglue.codec.AgentInterface
public void agent_end(double arg0)
agent_end
in interface org.rlcommunity.rlglue.codec.AgentInterface
public void agent_init(java.lang.String arg0)
agent_init
in interface org.rlcommunity.rlglue.codec.AgentInterface
public java.lang.String agent_message(java.lang.String arg0)
agent_message
in interface org.rlcommunity.rlglue.codec.AgentInterface
public org.rlcommunity.rlglue.codec.types.Action agent_start(org.rlcommunity.rlglue.codec.types.Observation arg0)
agent_start
in interface org.rlcommunity.rlglue.codec.AgentInterface
public org.rlcommunity.rlglue.codec.types.Action agent_step(double arg0, org.rlcommunity.rlglue.codec.types.Observation arg1)
agent_step
in interface org.rlcommunity.rlglue.codec.AgentInterface
public State actionCall(int actionId)
actionId
- the RLGlue action id