![]() |
IAtari
Genetic algorithm generating AI capable to play Atari2600 games.
|
Slave part of the algorithm, perform test on agents. More...
#include <slave.hpp>
Public Member Functions | |
slave (const std::string &master_name, int port, worker w, int duration=1e6) | |
Standard constructor. More... | |
void | run () |
In a coroutine, initialize a connection with the master throught a socket and perform as many test as requested. More... | |
message::result< Res > | do_work (const message::request< Params > &) |
Test an agent. More... | |
Private Types | |
using | worker = std::function< message::result< Res >(const message::request< Params > &)> |
Private Attributes | |
std::string | master_name |
std::string | port |
worker | producer |
int | duration |
Slave part of the algorithm, perform test on agents.
|
private |
|
inline |
Standard constructor.
master_name | Name of the machine that owned this slave |
port | Port used to communicate over the network |
w | Method used to test the agents |
duration | Slave max life-time, 1,000,000 minutes by default |
message::result< Res > slave< Res, Params >::do_work | ( | const message::request< Params > & | request | ) |
Test an agent.
request | Agent to be tested |
void slave< Res, Params >::run | ( | ) |
In a coroutine, initialize a connection with the master throught a socket and perform as many test as requested.
First of all, a socket is created and attempt a connection to the master.
Then, when the slave receives a request, the given agent is tested and the result is sent back to the master.
The slave continues to work until the socket is disconnected or the slave duration is exceeded.
|
private |
Slave max life-time in minutes
|
private |
Name of the machine that owned this slave
|
private |
Port used to communicate over the network
Method used to test the agents