#include <choreoFitness.h>
Public Member Functions | |
| ChoreoFitness (const std::string &name) | |
| Constructor. | |
| void | ProcessMessage (const dtGame::Message &message) |
| Handle messages from the GM. | |
Protected Member Functions | |
| virtual | ~ChoreoFitness () |
| Destructor. | |
This is an example use of the base input component for our tutorial. We will put all of our keyboard and mouse event handling in here. As a GM component, it will also receive all game messages in ProcessMessage() and DispatchNetworkMessage().
Definition at line 15 of file choreoFitness.h.
| srAlmende::ChoreoFitness::ChoreoFitness | ( | const std::string & | name | ) |
Constructor.
This component is a dtGame::GMComponent which each simulation tick calculates the attribution to the fitness defined per robot. In this implementation each robot does have the same genetic code, so fitness can just be averaged and used as a global figure. At the end of the trial this component sends a message with the accumulated fitness value to the tcpipComponent class in the form of a TCPIP message.
Definition at line 24 of file choreoFitness.cpp.
| void srAlmende::ChoreoFitness::ProcessMessage | ( | const dtGame::Message & | message | ) |
Handle messages from the GM.
Each tick the success of the robot population is measured, using routines on the AlmChoreoAgent class. The fitness is incremented each tick with a certain amount. After a predefined number of trials, a message is sent with the fitness values to the TCP/IP component. In this implementation the fitness value for all (both) robots will be the same. Different robots in the same generation are not put in parallel, but are tested out at different times.
Start measuring fitness after receiving a "reincarnation" command.
Definition at line 87 of file choreoFitness.cpp.
1.6.1