Method
getFunctionToReproduce
(EvolvableFunction[] functions, double totalPoints)
Source from the content-addressed store, hash-verified
| 259 | } |
| 260 | |
| 261 | private int getFunctionToReproduce(EvolvableFunction[] functions, double totalPoints) |
| 262 | { |
| 263 | double randomPoints = totalPoints*random.nextDouble(); |
| 264 | |
| 265 | for(int i=0; i<functions.length; i++) |
| 266 | { |
| 267 | if(totalPoints > randomPoints) |
| 268 | { |
| 269 | totalPoints -= functions[i].points; |
| 270 | } |
| 271 | else |
| 272 | { |
| 273 | return i; |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | return 0; |
| 278 | } |
| 279 | |
| 280 | private double getTotalPoints(EvolvableFunction[] functions) |
| 281 | { |
Tested by
no test coverage detected