Examples of ParameterArray


Examples of com.barrybecker4.optimization.parameter.ParameterArray

    public void doTest(OptimizationStrategyType optType, Optimizer optimizer,
                       ParameterArray initialGuess, double fitnessRange) {

        pointsList = new PointsList(solutionPosition, EDGE_SIZE);
        ParameterArray solution = null;
        try {
            solution = optimizer.doOptimization(optType, initialGuess, fitnessRange);
        } catch(AbstractMethodError e) {
            // allow continuing if the strategy has simply not been implemented yet.
            e.printStackTrace();
View Full Code Here

Examples of com.barrybecker4.optimization.parameter.ParameterArray

        // 3 sample points along each dimension
        gsStrategy.setSamplingRate(NUM_SAMPLES);

        // first find a good place to start
        // perhaps we should try several of the better results from global sampling.
        ParameterArray sampledParams = gsStrategy.doOptimization(params, fitnessRange);

        OptimizationStrategy strategy = new HillClimbingStrategy(optimizee_);
        strategy.setListener(listener_);
        return strategy.doOptimization(sampledParams, fitnessRange);
    }
View Full Code Here

Examples of com.barrybecker4.optimization.parameter.ParameterArray

        if (GUIUtil.hasBasicService())
            optimizer = new Optimizer( this );
        else
            optimizer = new Optimizer( this, FileUtil.getHomeDir()+ "performance/liquid/liquid_optimization.txt" );
        Parameter[] params = new Parameter[3];
        ParameterArray paramArray = new NumericParameterArray( params );

        setPaused(false);
        optimizer.doOptimization(OptimizationStrategyType.GENETIC_SEARCH, paramArray, 0.3);
    }
View Full Code Here

Examples of com.barrybecker4.optimization.parameter.ParameterArray

            optimizer = new Optimizer( this, FileUtil.getHomeDir() +"performance/trebuchet/trebuchet_optimization.txt" );
        Parameter[] params = new Parameter[NUM_PARAMS];
        //params[0] = new Parameter( WAVE_SPEED, 0.0001, 0.02, "wave speed" );
        //params[1] = new Parameter( WAVE_AMPLITUDE, 0.001, 0.2, "wave amplitude" );
        //params[2] = new Parameter( WAVE_PERIOD, 0.5, 9.0, "wave period" );
        ParameterArray paramArray = new NumericParameterArray( params );

        setPaused(false);
        optimizer.doOptimizationOptimizationStrategyType.GENETIC_SEARCH, paramArray, 0.3);
    }
View Full Code Here

Examples of com.barrybecker4.optimization.parameter.ParameterArray

     * @return the optimized params.
     */
     @Override
     public ParameterArray doOptimization( ParameterArray params, double fitnessRange) {

         ParameterArray lastBest;
         desiredPopulationSize_ = params.getSamplePopulationSize();

         // create an initial population based on params and POPULATION_SIZE-1 other random candidate solutions.
         List<ParameterArray> population = new LinkedList<ParameterArray>();
         population.add(params);

         for (int i = 1; i < desiredPopulationSize_; i++) {
             ParameterArray nbr = params.getRandomNeighbor(INITIAL_RADIUS);
             if (!population.contains(nbr)) {
                 population.add(nbr);
             }
         }
         assert(population.size() > 0);
View Full Code Here

Examples of com.barrybecker4.optimization.parameter.ParameterArray

     * Find the new best candidate.
     * @return the new best candidate.
     */
    private ParameterArray findNewBest(ParameterArray params, ParameterArray lastBest,
                                       List<ParameterArray> population) {
        ParameterArray currentBest;
        int ct = 0;
        double deltaFitness;
        ParameterArray recentBest = lastBest;

        // each iteration represents a new generation of the population.
        do {
            int keepSize = cullPopulation(population);
            replaceCulledWithKeeperVariants(population, keepSize);
View Full Code Here

Examples of com.barrybecker4.optimization.parameter.ParameterArray

            // do the best one twice to avoid terminating too quickly
            // in the event that we got a very good fitness score on an early iteration.
            if (keeperIndex == keepSize-1) {
                keeperIndex = 0;
            }
            ParameterArray p = population.get(keeperIndex);

            // add a permutation of one of the keepers
            // we multiply the radius by m because we want the worse ones to have
            // higher variability.
            double r = (keeperIndex + NBR_RADIUS_SOFTENER)/NBR_RADIUS_SOFTENER * nbrRadius_;
            ParameterArray nbr = p.getRandomNeighbor(r);
            if (!population.contains(nbr)) {
                population.add(nbr);
                notifyOfChange(p);
            }
            k++;
View Full Code Here

Examples of com.barrybecker4.optimization.parameter.ParameterArray

     * @param population the population to evaluate
     * @param previousBest the best solution from the previous iteration
     * @return the new best solution.
     */
    protected ParameterArray evaluatePopulation(List<ParameterArray> population, ParameterArray previousBest) {
        ParameterArray bestFitness = previousBest;

        for (ParameterArray p : population) {

            double fitness;
            if (optimizee_.evaluateByComparison()) {
                fitness = optimizee_.compareFitness(p, previousBest);
            } else {
                fitness = optimizee_.evaluateFitness(p);
            }
            System.out.println("f="+fitness);
            p.setFitness(fitness);
            if (fitness > bestFitness.getFitness()) {
                bestFitness = p;
                // show it if better than what we had before
                notifyOfChange(p);
                ThreadUtil.sleep(500);
            }
        }
        return bestFitness.copy();
    }
View Full Code Here

Examples of com.barrybecker4.optimization.parameter.ParameterArray

        if (GUIUtil.hasBasicService())
            optimizer = new Optimizer( this );
        else
            optimizer = new Optimizer( this, FileUtil.getHomeDir() +"performance/fluid/fluid_optimization.txt" );
        Parameter[] params = new Parameter[3];
        ParameterArray paramArray = new NumericParameterArray( params );

        setPaused(false);
        optimizer.doOptimization(OptimizationStrategyType.GENETIC_SEARCH, paramArray, 0.3);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.