OpenANN  1.1.0
An open source library for artificial neural networks.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agent.h
Go to the documentation of this file.
1 #ifndef AGENT_H
2 #define AGENT_H
3 
4 /*
5  * If any of these functions return < 0, it indicates an error and the agent
6  * handler will abort. A return value >= 0 indicates that the agent can
7  * continue
8  */
9 
10 /* The first two variables indicate the size of the state_data and
11  * out_action arrays respectively, these numbers are constant throughout
12  * the length of the simulation.
13  *
14  * argc and agent_param are the remainder of the argv parameters passed on the
15  * command line minus the first 4 (name of program, ip and port of
16  * server and number of episodes)
17  */
18 int agent_init(int num_state_variables, int num_action_variables, int argc, const char* agent_param[]);
19 
20 /* When this function is called, the agent should return it's name. This
21  * name will be used to identify individual agents during the competition.
22  * The name should not contain any spaces nor linefeed characters.
23  */
24 const char* agent_get_name();
25 
26 /* Start an episode.
27  * The agent is given the initial state in state_data.
28  * The agent gives the action to take in out_action.
29  * The size of these arrays has been specified in a prior call to agent_init.
30  */
31 int agent_start(double state_data[], double out_action[]);
32 
33 /* Perform a single step of an episode.
34  * The agent is given the reward for the previous action in reward.
35  * The new state is given in state_data.
36  * The agent gives the action to take in out_action.
37  * The size of these arrays has been specified in a prior call to agent_init.
38  */
39 int agent_step(double state_data[], double reward, double out_action[]);
40 
41 /* The agent has reached a terminal state, indicating the end of an episode.
42  * The agent is given the final reward for the previous action in reward.
43  */
44 int agent_end(double reward);
45 
46 /* The program will close so the agent should free any resource it has allocated
47  */
48 void agent_cleanup();
49 
50 #endif