Project Malmo  0.30.0
Public Member Functions | Friends | List of all members
malmo::ALEAgentHost Class Reference

An ALE agent host mediates between the researcher's code (the agent) and the ALE (the target environment). More...

#include <ALEAgentHost.h>

Inheritance diagram for malmo::ALEAgentHost:
malmo::ArgumentParser

Public Member Functions

 ALEAgentHost ()
 Creates an agent host with default settings.
 
 ~ALEAgentHost ()
 Destructor.
 
void setSeed (int seed)
 Set the random seed used to seed the ALE. More...
 
void startMission (const MissionSpec &mission, const ClientPool &client_pool, const MissionRecordSpec &mission_record, int role, std::string unique_experiment_id)
 Starts a mission running. More...
 
void startMission (const MissionSpec &mission, const MissionRecordSpec &mission_record)
 Starts a mission running, in the simple case where there is only one agent running on the local machine. More...
 
WorldState peekWorldState () const
 Gets the latest world state received from the game. More...
 
WorldState getWorldState ()
 Gets the latest world state received from the game. More...
 
std::string getRecordingTemporaryDirectory () const
 Gets the temporary directory being used for the mission record, if recording is taking place. More...
 
void setVideoPolicy (AgentHost::VideoPolicy videoPolicy)
 Specifies how you want to deal with multiple video frames. More...
 
void setRewardsPolicy (AgentHost::RewardsPolicy rewardsPolicy)
 Specifies how you want to deal with multiple rewards. More...
 
void setObservationsPolicy (AgentHost::ObservationsPolicy observationsPolicy)
 Specifies how you want to deal with multiple observations. More...
 
void sendCommand (std::string command)
 Sends a command to the game client. More...
 
void close ()
 
void parseArgs (int argc, const char **argv)
 Parses a list of strings given in the C style. Throws std::exception if parsing fails. More...
 
void parse (const std::vector< std::string > &args)
 Parses a list of strings. Throws std::exception if parsing fails. More...
 
void addOptionalIntArgument (const std::string &name, const std::string &description, int defaultValue)
 Specify an integer argument that can be given on the command line. More...
 
void addOptionalFloatArgument (const std::string &name, const std::string &description, double defaultValue)
 Specify a floating-point argument that can be given on the command line. More...
 
void addOptionalStringArgument (const std::string &name, const std::string &description, const std::string &defaultValue)
 Specify a string argument that can be given on the command line. More...
 
void addOptionalFlag (const std::string &name, const std::string &description)
 Specify a boolean flag that can be given on the command line. More...
 
std::string getUsage () const
 Gets a string that describes the current set of options we expect. More...
 
bool receivedArgument (const std::string &name) const
 Gets whether a named argument was parsed on the command-line arguments. More...
 
int getIntArgument (const std::string &name) const
 Retrieves the value of a named integer argument. More...
 
double getFloatArgument (const std::string &name) const
 Retrieves the value of a named floating-point argument. More...
 
std::string getStringArgument (const std::string &name) const
 Retrieves the value of a named string argument. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const ALEAgentHost &ah)
 

Detailed Description

An ALE agent host mediates between the researcher's code (the agent) and the ALE (the target environment).

Member Function Documentation

void malmo::ArgumentParser::addOptionalFlag ( const std::string &  name,
const std::string &  description 
)
inherited

Specify a boolean flag that can be given on the command line.

Parameters
nameThe name of the flag. To be given as "--name"
descriptionThe explanation of the flag that can be printed out.
void malmo::ArgumentParser::addOptionalFloatArgument ( const std::string &  name,
const std::string &  description,
double  defaultValue 
)
inherited

Specify a floating-point argument that can be given on the command line.

Parameters
nameThe name of the argument. To be given as "--name <value>"
descriptionThe explanation of the argument that can be printed out.
defaultValueThe value that this argument should have if not given on the command line.
void malmo::ArgumentParser::addOptionalIntArgument ( const std::string &  name,
const std::string &  description,
int  defaultValue 
)
inherited

Specify an integer argument that can be given on the command line.

Parameters
nameThe name of the argument. To be given as "--name <value>"
descriptionThe explanation of the argument that can be printed out.
defaultValueThe value that this argument should have if not given on the command line.
void malmo::ArgumentParser::addOptionalStringArgument ( const std::string &  name,
const std::string &  description,
const std::string &  defaultValue 
)
inherited

Specify a string argument that can be given on the command line.

Parameters
nameThe name of the argument. To be given as "--name <value>"
descriptionThe explanation of the argument that can be printed out.
defaultValueThe value that this argument should have if not given on the command line.
double malmo::ArgumentParser::getFloatArgument ( const std::string &  name) const
inherited

Retrieves the value of a named floating-point argument.

Parameters
nameThe name of the argument.
Returns
The value of the named argument.
int malmo::ArgumentParser::getIntArgument ( const std::string &  name) const
inherited

Retrieves the value of a named integer argument.

Parameters
nameThe name of the argument.
Returns
The value of the named argument.
std::string malmo::ALEAgentHost::getRecordingTemporaryDirectory ( ) const

Gets the temporary directory being used for the mission record, if recording is taking place.

Returns
The temporary directory for the mission record, or an empty string if no recording is going on.
std::string malmo::ArgumentParser::getStringArgument ( const std::string &  name) const
inherited

Retrieves the value of a named string argument.

Parameters
nameThe name of the argument.
Returns
The value of the named argument.
std::string malmo::ArgumentParser::getUsage ( ) const
inherited

Gets a string that describes the current set of options we expect.

Returns
The usage string, for displaying.
WorldState malmo::ALEAgentHost::getWorldState ( )

Gets the latest world state received from the game.

Resets the count of items received since the last time.

Returns
The world state.
void malmo::ArgumentParser::parse ( const std::vector< std::string > &  args)
inherited

Parses a list of strings. Throws std::exception if parsing fails.

In C++: takes a std::vector<std::string>. In Python: takes a list of strings. In Lua: takes a table of strings.

Parameters
argsThe arguments to parse.
void malmo::ArgumentParser::parseArgs ( int  argc,
const char **  argv 
)
inherited

Parses a list of strings given in the C style. Throws std::exception if parsing fails.

Available in C++ only. In other languages use the parse function instead.

Parameters
argcThe number of arguments.
argvThe arguments to parse.
See also
parse()
WorldState malmo::ALEAgentHost::peekWorldState ( ) const

Gets the latest world state received from the game.

Returns
The world state.
bool malmo::ArgumentParser::receivedArgument ( const std::string &  name) const
inherited

Gets whether a named argument was parsed on the command-line arguments.

Parameters
nameThe name of the argument.
Returns
True if the named argument was received.
void malmo::ALEAgentHost::sendCommand ( std::string  command)

Sends a command to the game client.

See the mission handlers documentation for the permitted commands for your chosen command handler.

Parameters
commandThe command to send as a string. e.g. "move 1"
void malmo::ALEAgentHost::setObservationsPolicy ( AgentHost::ObservationsPolicy  observationsPolicy)

Specifies how you want to deal with multiple observations.

Parameters
observationsPolicyHow you want to deal with multiple observations coming in asynchronously.
void malmo::ALEAgentHost::setRewardsPolicy ( AgentHost::RewardsPolicy  rewardsPolicy)

Specifies how you want to deal with multiple rewards.

Parameters
rewardsPolicyHow you want to deal with multiple rewards coming in asynchronously.
void malmo::ALEAgentHost::setSeed ( int  seed)
inline

Set the random seed used to seed the ALE.

If 0 (the default), the ALE will use the current time instead.

void malmo::ALEAgentHost::setVideoPolicy ( AgentHost::VideoPolicy  videoPolicy)

Specifies how you want to deal with multiple video frames.

Parameters
videoPolicyHow you want to deal with multiple video frames coming in asynchronously.
void malmo::ALEAgentHost::startMission ( const MissionSpec mission,
const ClientPool client_pool,
const MissionRecordSpec mission_record,
int  role,
std::string  unique_experiment_id 
)

Starts a mission running.

Throws an exception if something goes wrong.

Parameters
missionThe mission specification.
client_poolleave this null - meaningless for ALE
mission_recordThe specification of the mission recording to make.
roleIndex of the agent that this agent host is to manage. Zero-based index. Use zero if there is only one agent in this mission.
unique_experiment_idAn arbitrary identifier that is used to disambiguate our mission from other runs.
void malmo::ALEAgentHost::startMission ( const MissionSpec mission,
const MissionRecordSpec mission_record 
)

Starts a mission running, in the simple case where there is only one agent running on the local machine.

Throws an exception if something goes wrong.

Parameters
missionThe mission specification.
mission_recordThe specification of the mission recording to make.

The documentation for this class was generated from the following file: