Changeset 263
- Timestamp:
- 12/10/14 14:08:12 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experiments/frams/evolve-speed-vs-gravity/data/scripts/evolve-speed-vs-gravity.script
r250 r263 9 9 Populations[0].perfperiod=100000; //fitness: velocity serves as distance (because sampling period is longer than lifespan) 10 10 ExpParams.initialgen="XX[|,1:1][N,1:1,2:1][T][G]"; 11 GenePools[0].fitness="""function penalty(count) 11 12 //custom fitness function: velocity minus small penalty for complexity (high number of parts, joints, neurons, connections) 13 GenePools[0].fitness=""" 14 var MAX_WITHOUT_PENALTY=50; 15 function penalty(count) 12 16 { 13 var toomany=count- 50;17 var toomany=count-MAX_WITHOUT_PENALTY; 14 18 if (toomany<=0) return 0; else return -toomany*0.001; 15 19 } … … 34 38 while (Simulator.running && best.popsiz<min_evaluations) //repeat until the best genotype will be evaluated at least min_evaluations times 35 39 { 36 for(var t=best.lifespan; t>0 && Simulator.running; t--) 37 Simulator.step(); // simulate 'expected lifespan' steps after which 'best' may have changed. This helps avoid too frequent calls to best()40 for(var t=best.lifespan; t>0 && Simulator.running; t--) // simulate 'expected lifespan' steps after which 'best' may have changed. This helps avoid frequent unnecessary calls to best() 41 Simulator.step(); 38 42 best=GenePools[0].best(); 39 43 }
Note: See TracChangeset
for help on using the changeset viewer.