Changeset 250


Ignore:
Timestamp:
11/08/14 16:56:00 (10 years ago)
Author:
Maciej Komosinski
Message:

Introduced penalty for too complex creatures and saves best genotypes in files for further examination

File:
1 edited

Legend:

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

    r184 r250  
    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        
     11        GenePools[0].fitness="""function penalty(count)
     12 {
     13 var toomany=count-50;
     14 if (toomany<=0) return 0; else return -toomany*0.001;
     15 }
     16 return this.velocity+penalty(this.numparts)+penalty(this.numjoints)+penalty(this.numneurons)+penalty(this.numconnections);""";
     17
    1218        Simulator.init();
    1319        //Simulator.print(GenePools[0][0].genotype); //ensure the initialgen is in the gene pool
     
    3440        Simulator.stop();
    3541        Simulator.print("%g (x%g) %s" % best.fit % best.popsiz % best.genotype);
     42       
     43        GenePools[0].clear(); //remove all...
     44        best.moveTo(GenePools[0]); //...then restore best...
     45        Simulator.save("best_%g_%u.expt" % gravity % (0+Math.time)); //...and save it in a file just in case we want to see all of its data
    3646}
    3747~
Note: See TracChangeset for help on using the changeset viewer.