Simulating AI-based agents
- The neural network (brain) has one input layer, 3 hidden layers and one output layer.
- A Genome define the connections between the neurons. The number of genes is limited.
- The simulation
- Agents are placed randomly on a 2D world at the beginning of a cycle.
- Agents can reproduce at the end of a cycle before they die.
- Agents need to reach a target area where they can reproduce.
- Accelerating (a>0) costs energy. Energy is replenished while stationary (v=0).
- Friction reduces the velocity over time if agents do not accelerate.
- Agents can not move into or over each other.
- Target areas emit a field that permeates the world and can be sensed by the agents.
- A cycle consists of
$N_{Cy}$ steps.
Short | Name | Description | Range |
---|---|---|---|
TDe | Target field Density | ||
TGH | Target field Gradient Heading | ||
TGL | Target field gradient Lateral | ||
Vel | Velocity | ||
Hdg | Heading | ||
Age | Age | ||
Rnd | Random Value | ||
Nrg | Energy | ||
Pop | Population Density | Averaged over a NxN Grid | |
PGH | Population Gradient Heading | along the current heading over a NxN grid | |
PGL | Population Gradient Lateral | lateral to current heading over a NxN Grid | |
Osc | Oscillator | ||
Blk | Blockage | Path (heading) is blocked Within N gid-units. | 0..1 |
BLt | Blockage Lateral | Blockage left/right with respect to heading over NxN grid |
Short | Name | Description | Range |
---|---|---|---|
Acc | Accelerate | ||
Rot | Rotate |
A gene is encoded as a 32-bit unsigned integer (uint32_t
)
0 0000000 0 0000000 0000000000000000
| | | | L 16-bit weight (-4..4)
| | | L 7-bit sinkID
| | L sinkType (0=Hidden, 1=Output)
| L 7-bit sourceID
sourceType (0=Hidden, 1=Input)
During reproduction, a random bit in the genome of an agent is flipped. These mutations occur with a defined probability.
git submodule update --init --recursive
mkdir build && cd build
cmake ..
make
./project
cd path/to/glfw
cmake -S . -B build
cd build
make
see glad