Package ec.util

Examples of ec.util.Output$OutputExitException


             */
            void initializeEvolutionState()
                throws BadParameterException, ParamClassLoadException
                {
                listeners.removeAllElements();
                Output output = initializeOutput();
               
                // 2. set up thread values
                /*
                  int breedthreads = parameters.getInt(
                  new Parameter(Evolve.P_BREEDTHREADS),null,1);
                  if (breedthreads < 1)
                  Output.initialError("Number of breeding threads should be an integer >0.",
                  new Parameter(Evolve.P_BREEDTHREADS));
               
                  int evalthreads = parameters.getInt(
                  new Parameter(Evolve.P_EVALTHREADS),null,1);
                  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)
                    {
View Full Code Here


        throws BadParameterException
        {
        // 1. create the output
        //boolean store = parameters.getBoolean(new Parameter(Evolve.P_STORE),null,false);
       
        Output output = new Output(true);
        //output.setFlush(
        //    parameters.getBoolean(new Parameter(Evolve.P_FLUSH),null,false));
       
       
        // stdout is always log #0.  stderr is always log #1.
        // stderr accepts announcements, and both are fully verbose
        // by default.
        output.addLog(ec.util.Log.D_STDOUT,false);
        output.addLog(ec.util.Log.D_STDERR,true);
        output.systemMessage(Version.message());
        return output;
        }
View Full Code Here

TOP

Related Classes of ec.util.Output$OutputExitException

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.