001    /*
002     * Copyright 2011 Christian Kumpe http://kumpe.de/christian/java
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package de.kumpe.hadooptimizer.examples.functions;
017    
018    import de.kumpe.hadooptimizer.EaOptimizerConfiguration;
019    import de.kumpe.hadooptimizer.examples.OptimizerExample;
020    import de.kumpe.hadooptimizer.impl.GaussianMutator;
021    import de.kumpe.hadooptimizer.impl.PolynomialEvaluator;
022    
023    /**
024     * Tries to minimize a polygon.
025     * 
026     * @author <a href="http://kumpe.de/christian/java">Christian Kumpe</a>
027     */
028    public final class Polynomial extends OptimizerExample<double[]> {
029            @Override
030            protected EaOptimizerConfiguration<double[]> createEaOptimizerConfiguration() {
031                    final EaOptimizerConfiguration<double[]> conf = new EaOptimizerConfiguration<double[]>();
032                    initConfiguration(conf, new double[] { 100 });
033                    conf.setMutator(new GaussianMutator());
034                    conf.setEvaluator(new PolynomialEvaluator(-1, 1));
035                    return conf;
036            }
037    
038            @Override
039            protected String getVersionInfo() {
040                    return "$Id: Polynomial.java 3890 2011-04-20 14:58:14Z baumbart $";
041            }
042    }