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;
017    
018    import de.kumpe.hadooptimizer.impl.EsMutatorWrapper;
019    
020    /**
021     * Makes a {@link Mutator} wrappable by the {@link EsMutatorWrapper}.
022     * <p>
023     * In most cases the mutator's individual's type will be <code>double[]</code>
024     * and its {@link Mutator#mutate(Object)} will just delegate to its
025     * {@link #mutate(double[], double)}.
026     * 
027     * @author <a href="http://kumpe.de/christian/java">Christian Kumpe</a>
028     */
029    public interface EsWrappableMutator {
030            /**
031             * Mutates the given individual with the specified increment.
032             * 
033             * @param individual
034             *            the individual to mutate
035             * @param increment
036             *            the increment for the mutation (mainly the standard deviation
037             *            of a normal distributed random number)
038             * @return the mutant
039             */
040            double[] mutate(double[] individual, double increment);
041    
042            /**
043             * Returns the minimal allowed increment. In the evolution strategies
044             * automatic increment adaption the ist the increment's lower bound.
045             * 
046             * @return the minimal allowed increment
047             */
048            double getMinIncrement();
049    }