Project Malmo
0.21.0
|
An ALE agent host mediates between the researcher's code (the agent) and the ALE (the target environment). More...
#include <ALEAgentHost.h>
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) |
An ALE agent host mediates between the researcher's code (the agent) and the ALE (the target environment).
|
inherited |
Specify a boolean flag that can be given on the command line.
name | The name of the flag. To be given as "--name" |
description | The explanation of the flag that can be printed out. |
|
inherited |
Specify a floating-point argument that can be given on the command line.
name | The name of the argument. To be given as "--name <value>" |
description | The explanation of the argument that can be printed out. |
defaultValue | The value that this argument should have if not given on the command line. |
|
inherited |
Specify an integer argument that can be given on the command line.
name | The name of the argument. To be given as "--name <value>" |
description | The explanation of the argument that can be printed out. |
defaultValue | The value that this argument should have if not given on the command line. |
|
inherited |
Specify a string argument that can be given on the command line.
name | The name of the argument. To be given as "--name <value>" |
description | The explanation of the argument that can be printed out. |
defaultValue | The value that this argument should have if not given on the command line. |
|
inherited |
Retrieves the value of a named floating-point argument.
name | The name of the argument. |
|
inherited |
Retrieves the value of a named integer argument.
name | The name of the argument. |
std::string malmo::ALEAgentHost::getRecordingTemporaryDirectory | ( | ) | const |
Gets the temporary directory being used for the mission record, if recording is taking place.
|
inherited |
Retrieves the value of a named string argument.
name | The name of the argument. |
|
inherited |
Gets a string that describes the current set of options we expect.
WorldState malmo::ALEAgentHost::getWorldState | ( | ) |
Gets the latest world state received from the game.
Resets the count of items received since the last time.
|
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.
args | The arguments to parse. |
|
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.
argc | The number of arguments. |
argv | The arguments to parse. |
WorldState malmo::ALEAgentHost::peekWorldState | ( | ) | const |
Gets the latest world state received from the game.
|
inherited |
Gets whether a named argument was parsed on the command-line arguments.
name | The name of the argument. |
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.
command | The 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.
observationsPolicy | How 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.
rewardsPolicy | How you want to deal with multiple rewards coming in asynchronously. |
|
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.
videoPolicy | How 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.
mission | The mission specification. |
client_pool | leave this null - meaningless for ALE |
mission_record | The specification of the mission recording to make. |
role | Index 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_id | An 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.
mission | The mission specification. |
mission_record | The specification of the mission recording to make. |