selectcompose.java

来自「遗传算法源代码,实现了选择操作、交叉操作和变异操作」· Java 代码 · 共 54 行

JAVA
54
字号
/*--- formatted by Jindent 2.1, (www.c-lab.de/~jindent) ---*//** * SelectAll Class * * location: net.openai.ai.ga.selection.common.SelectAll * */package net.openai.ai.ga.selection.common;import net.openai.ai.ga.selection.*;import net.openai.ai.ga.population.*;import net.openai.ai.ga.cell.*;import java.util.Collection;/** * <code>SelectAll</code> is a <code>SelectionAlgorithm</code> * that will returns the result of a <code>SelectionAlgorithm</code> on * the <code>Population</code> returned from the second, i.e. * first(second()). * * @author	Jared Grubb * @version	%I%, %G% * @since	JDK1.3 */public class SelectCompose implements SelectionAlgorithm {    private SelectionAlgorithm first, second;    /**     * Creates a new <code>SelectAll</code> object.     */    public SelectCompose(SelectionAlgorithm first,                     SelectionAlgorithm second) {        this.first = first;        this.second = second;    }    /**     * Returns a <code>Population</code> that is a clone of the specified     * <code>Population<code>. This represents a "keep-all" method.     *     * @param pop  the <code>Population</code> to choose from     * @return a cloned <code>Population</code>     */    public Population selectFromPopulation(Population pop) {        return first.selectFromPopulation(second.selectFromPopulation(pop));    }}/*--- formatting done in "Sun Java Convention" style on 12-28-2000 ---*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?