Changeset 57


Ignore:
Timestamp:
01/26/10 15:27:17 (14 years ago)
Author:
mszubert
Message:

Population initialization parametrized - getSimplest macro is called with an appropriate additional parameter specifying initialization type.

Location:
java/ecj/framsticks
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • java/ecj/framsticks/FramsticksIndividual.java

    r44 r57  
    1111public class FramsticksIndividual extends Individual {
    1212
    13         public static final String P_FRAMSTICKS_INDIVIDUAL = "framssticks-ind";
     13        private static final String P_FRAMSTICKS_INDIVIDUAL = "framsticks-ind";
     14        private static final String P_INIT_TYPE = "init-type";
    1415
    1516        public String genotype;
     
    3940        public void setup(final EvolutionState state, final Parameter base) {
    4041                super.setup(state, base);
    41                 genotype = FramsticksUtils.getInstance(state).getNewGenotype();
     42               
     43                Parameter initTypeParam = base.push(P_INIT_TYPE);
     44                int initializationType = state.parameters.getIntWithDefault(initTypeParam, null, 0);
     45                genotype = FramsticksUtils.getInstance(state).getNewGenotype(initializationType);
    4246        }
    4347
  • java/ecj/framsticks/FramsticksUtils.java

    r51 r57  
    1818public class FramsticksUtils {
    1919
    20         private static final String NEW_CMD = "%s \"getsimplest 1\" -q";
     20        private static final String NEW_CMD = "%s \"getsimplest 1 %s\" -q";
    2121        private static final String EVAL_CMD = "%s \"ex %s\" \"eval %s %s\" -q";
    2222        private static final String MUTATE_CMD = "%s rnd mut -q < %s";
     
    183183        }
    184184
    185         public String getNewGenotype() {
    186                 return executeCommand(String.format(NEW_CMD, executableCommand));
     185        public String getNewGenotype(int initializationType) {
     186                return executeCommand(String.format(NEW_CMD, executableCommand, initializationType));
    187187        }
    188188
  • java/ecj/framsticks/frams_coevolution2.params

    r55 r57  
    2424pop.subpop.1    = ec.Subpopulation
    2525
    26 pop.subpop.0.size         = 8
    27 pop.subpop.1.size         = 8
     26pop.subpop.0.size         = 1
     27pop.subpop.1.size         = 1
    2828pop.subpop.0.duplicate-retries  = 0
    2929pop.subpop.1.duplicate-retries  = 0
     
    3434pop.subpop.0.species.crossover-prob = 1.0
    3535pop.subpop.0.species.mutation-prob  = 0.1
     36pop.subpop.0.species.ind.init-type      = 2
    3637
    3738pop.subpop.1.species            = framsticks.FramsticksSpecies
     
    4041pop.subpop.1.species.crossover-prob = 1.0
    4142pop.subpop.1.species.mutation-prob  = 0.1
     43pop.subpop.1.species.ind.init-type      = 1
    4244
    4345pop.subpop.0.species.pipe                   = framsticks.FramsticksMutationPipeline
Note: See TracChangeset for help on using the changeset viewer.