| 27 | } |
| 28 | |
| 29 | void TrainingGround::Mutate(RaceNet &toMutate) { |
| 30 | for (uint8_t mut_Idx = 0; mut_Idx < 5; ++mut_Idx) { |
| 31 | unsigned long layerToMutate = rand() % toMutate.net.W.size(); |
| 32 | |
| 33 | auto &m = toMutate.net.W[layerToMutate]; |
| 34 | |
| 35 | int h = m.getHeight(); |
| 36 | int w = m.getWidth(); |
| 37 | |
| 38 | int xNeuronToMutate = rand() % h; |
| 39 | int yNeuronToMutate = rand() % w; |
| 40 | |
| 41 | m.put(xNeuronToMutate, yNeuronToMutate, m.get(xNeuronToMutate, yNeuronToMutate) * Utils::RandomFloat(0.5, 1.5)); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | // Move this to agent class? |
| 46 | float TrainingGround::EvaluateFitness(shared_ptr<Car> &car_agent) { |
nothing calls this directly
no test coverage detected