Darwin Neuroevolution Framework
|
#include <unicycle.h>
Public Member Functions | |
size_t | inputs () const override |
Number of inputs to a Brain. | |
size_t | outputs () const override |
Number of outputs from a Brain. | |
bool | evaluatePopulation (darwin::Population *population) const override |
Assigns fitness values to every genotype. More... | |
![]() | |
virtual unique_ptr< core::PropertySet > | calibrateGenotype ([[maybe_unused]] const Genotype *genotype) const |
Optional: additional fitness metrics (normally not used in the population evaluation, ie a test set) | |
Domain: Unicycle.
Yet another inverted pendulum variation: this time the pole is attached to a wheel and the agent tries to keep the pole balanced by applying torque to the wheel, similar to riding an unicycle.
The unicycle starts in the middle (x = 0) and the initial pole angles is a random value in the [-max_initial_angle, +max_initial_angle]
range. The pole is considered balanced if it remains between -max_angle
and +max_angle
. The unicycle's wheel must stay between -max_distance
and +max_distance
.
This problem introduces an additional goal: keep the unicycle close to a random target position. This is rewarded by a fitness bonus inversely proportional to the absolute distance from the target (but only if the pole is balanced for the whole episode)
The inputs are configurable by individually selecting at least one of:
Input | Value |
---|---|
0 | pole_angle |
1 | angular_velocity |
2 | wheel_distance |
3 | wheel_velocity |
4 | distance_from_target |
The single output indicates the torque to be applied to the wheel. This can be discrete (fixed +/-discrete_torque_magnitude depending on the sign of the output) or can be continuous (the output value maps directly to the torque magnitude)
Output | Value |
---|---|
0 | torque |
|
overridevirtual |
Assigns fitness values to every genotype.
Having a good fitness function is a key part of evolutionary algorithms:
true
if the evolution goal was reached Implements darwin::Domain.