Package ec.util

Examples of ec.util.Parameter


    public static final String P_PUSH = "push";

    /** Returns the default base. */
    public static final Parameter base()
        {
        return new Parameter(P_PUSH);
        }
View Full Code Here


    public static final String P_GE = "ge";

    /** Returns the default base. */
    public static final Parameter base()
        {
        return new Parameter(P_GE);
        }
View Full Code Here

    public static final String P_BREED = "breed";

    /** Returns the default base. */
    public static final Parameter base()
        {
        return new Parameter(P_BREED);
        }
View Full Code Here

    public static final String P_ES = "es";

    /** Returns the default base. */
    public static final Parameter base()
        {
        return new Parameter(P_ES);
        }
View Full Code Here

    private int[] seriesID;
   
    public void setup(EvolutionState state, Parameter base) {
        super.setup(state, base);
        int numSubPops = state.parameters.getInt(new Parameter("pop.subpops"),null);
       
        seriesID = new int[numSubPops];
       
        for (int i = 0; i < numSubPops; ++i) {
            seriesID[i] = i; //series id identifies each sub pop
View Full Code Here

    private int[] seriesID;
   
    public void setup(EvolutionState state, Parameter base) {
        super.setup(state, base);
        int numSubPops = state.parameters.getInt(new Parameter("pop.subpops"),null);
        seriesID = new int[numSubPops];
       
        for (int i = 0; i < numSubPops; ++i) {
            seriesID[i] = addSeries("SubPop "+i);
            }
View Full Code Here

    public static final String P_GP = "gp";

    /** Returns the default base. */
    public static final Parameter base()
        {
        return new Parameter(P_GP);
        }
View Full Code Here

                  if (evalthreads < 1)
                  Output.initialError("Number of eval threads should be an integer >0.",
                  new Parameter(Evolve.P_EVALTHREADS));
                */
               
                int breedthreads = Evolve.determineThreads(output, parameters, new Parameter(Evolve.P_BREEDTHREADS));
                int evalthreads = Evolve.determineThreads(output, parameters, new Parameter(Evolve.P_EVALTHREADS));
                @SuppressWarnings("unused")
        boolean auto = (Evolve.V_THREADS_AUTO.equalsIgnoreCase(parameters.getString(new Parameter(Evolve.P_BREEDTHREADS),null)) ||
                    Evolve.V_THREADS_AUTO.equalsIgnoreCase(parameters.getString(new Parameter(Evolve.P_EVALTHREADS),null)))// at least one thread is automatic.  Seeds may need to be dynamic.

                // 3. create the Mersenne Twister random number generators,
                // one per thread
                MersenneTwisterFast[] random = new MersenneTwisterFast[breedthreads > evalthreads ?
                    breedthreads : evalthreads];
                int[] seeds = new int[breedthreads > evalthreads ?
                    breedthreads : evalthreads];
               
                String seed_message = "Seed: ";
                for (int x=0;x<random.length;x++)
                   
                    {
                    seeds[x] = conPanel.getSeed(currentJob,x);
                    seed_message = seed_message + seeds[x] + " ";
                    }
               
                for (int x=0;x<random.length;x++)
                   
                    {
                    for (int y=x+1;y<random.length;y++)
                        if (seeds[x]==seeds[y])
                           
                            {
                            Output.initialError(Evolve.P_SEED+"."+x+" ("+seeds[x]+") and "+Evolve.P_SEED+"."+y+" ("+seeds[y]+") ought not be the same seed.");
                            }
                    random[x] = Evolve.primeGenerator(new MersenneTwisterFast(seeds[x]));   // we prime the generator to be more sure of randomness.
                    }
               
                state = (EvolutionState)parameters.getInstanceForParameter(
                    new Parameter(Evolve.P_STATE),null,EvolutionState.class);
               
                state.parameters = parameters;
                state.random = random;
                state.output = output;
                String jobFilePrefix = Console.this.conPanel.getJobFilePrefix();
                if (Console.this.conPanel.getNumJobs() > 1)
                    {
                    if (jobFilePrefix == null || jobFilePrefix.length()<1)
                        {
                        jobFilePrefix = "job";
                        }
                    jobFilePrefix = jobFilePrefix+"."+Console.this.currentJob+".";
                    state.output.setFilePrefix(jobFilePrefix);
                    }
               
                state.evalthreads = evalthreads;
                state.breedthreads = breedthreads;
               
                output.systemMessage("Threads:  breed/" + breedthreads + " eval/" + evalthreads);
                output.systemMessage(seed_message);
               
                state.startFresh();

                if (Console.this.conPanel.getNumJobs() > 0)
                    {
                    state.checkpointPrefix = jobFilePrefix+state.checkpointPrefix;
                    }

                if (currentJob == 0)
                    {
                    statisticsPane.removeAll();
                    }
               
                setupChartPanes();
                setupInspectionPanes();
                }
           
            /**
             * @throws NumberFormatException
             * @throws BadParameterException
             */
            void setupInspectionPanes()
                throws NumberFormatException, BadParameterException
                {
                inspectionPane.removeAll();
                // Setup the Evolution State inspection pane
                JScrollPane stateInspectionPane = new JScrollPane();
                JTree stateInspectionTree = new JTree(
                    new ReflectedObject(Console.this.state));
                stateInspectionPane.setViewportView(stateInspectionTree);
                inspectionPane.add("Evolution State", stateInspectionPane);
               
                // Setup the subpopulation inspection panes
                Parameter p_subPops = new Parameter("pop.subpops");
                int numSubPops = parameters.getInt(p_subPops,null);
                for (int subPop = 0; subPop < numSubPops; ++subPop)
                    {
                    SubpopulationPanel subPopPane = new SubpopulationPanel(Console.this, subPop);
                    subPopPane.setup(Console.this.state,p_subPops.push(""+subPop));
                    inspectionPane.add("SubPop "+subPop, subPopPane);
                    addListener(subPopPane);
                    }
                }

            /**
             * @throws BadParameterException
             */
            void setupChartPanes()
                throws BadParameterException
                {
                // Set up statistics charts (if any)
                StatisticsChartPane statPane = new StatisticsChartPane();
                statPane.setup(state, new Parameter("stat"));
                if (statPane.numCharts > 0)
                    statisticsPane.addTab("Job "+currentJob, statPane);
                }

            public void run()
View Full Code Here

            }
        }
   
    public void setup(final EvolutionState state, final Parameter base)
        {
        Parameter p = new Parameter(Initializer.P_POP).push(Population.P_SIZE);
        int size = state.parameters.getInt(p,null,1)// if size is wrong, we'll let Population complain about it -- for us, we'll just make 0-sized arrays and drop out.

        eliteFrac = new double[size];
        elite = new int[size];
        for(int i = 0; i < size; i++)
            eliteFrac[i] = elite[i] = NOT_SET;
        reevaluateElites = new boolean[size];
               
        sequentialBreeding = state.parameters.getBoolean(base.push(P_SEQUENTIAL_BREEDING), null, false);
        if (sequentialBreeding && (size == 1)) // uh oh, this can't be right
            state.output.fatal("The Breeder is breeding sequentially, but you have only one population.", base.push(P_SEQUENTIAL_BREEDING));

        clonePipelineAndPopulation =state.parameters.getBoolean(base.push(P_CLONE_PIPELINE_AND_POPULATION), null, true);
        if (!clonePipelineAndPopulation && (state.breedthreads > 1)) // uh oh, this can't be right
            state.output.fatal("The Breeder is not cloning its pipeline and population, but you have more than one thread.", base.push(P_CLONE_PIPELINE_AND_POPULATION));

        int defaultSubpop = state.parameters.getInt(new Parameter(Initializer.P_POP).push(Population.P_DEFAULT_SUBPOP), null, 0);
        for(int x=0;x<size;x++)
            {
            // get elites
            if (state.parameters.exists(base.push(P_ELITE).push(""+x),null))
                {
View Full Code Here

        // are our elites small enough?
        for(int x=0;x<state.population.subpops.length;x++)
            {
            if (numElites(state, x)>state.population.subpops[x].individuals.length)
                state.output.error("The number of elites for subpopulation " + x + " exceeds the actual size of the subpopulation",
                    new Parameter(EvolutionState.P_BREEDER).push(P_ELITE).push(""+x));
            if (numElites(state, x)==state.population.subpops[x].individuals.length)
                state.output.warning("The number of elites for subpopulation " + x + " is the actual size of the subpopulation",
                    new Parameter(EvolutionState.P_BREEDER).push(P_ELITE).push(""+x));
            }
        state.output.exitIfErrors();

        // we assume that we're only grabbing a small number (say <10%), so
        // it's not being done multithreaded
View Full Code Here

TOP

Related Classes of ec.util.Parameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.