Changeset 263


Ignore:
Timestamp:
12/10/14 14:08:12 (7 years ago)
Author:
Maciej Komosinski
Message:

Added a comment explaining the custom fitness function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • experiments/frams/evolve-speed-vs-gravity/data/scripts/evolve-speed-vs-gravity.script

    r250 r263  
    99        Populations[0].perfperiod=100000; //fitness: velocity serves as distance (because sampling period is longer than lifespan)
    1010        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)
    1216 {
    13  var toomany=count-50;
     17 var toomany=count-MAX_WITHOUT_PENALTY;
    1418 if (toomany<=0) return 0; else return -toomany*0.001;
    1519 }
     
    3438        while (Simulator.running && best.popsiz<min_evaluations) //repeat until the best genotype will be evaluated at least min_evaluations times
    3539        {
    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();
    3842                best=GenePools[0].best();
    3943        }
Note: See TracChangeset for help on using the changeset viewer.