abstractenvironment.java

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

JAVA
48
字号
/*--- formatted by Jindent 2.1, (www.c-lab.de/~jindent) ---*//** * AbstractEnvironment Class * * location: net.openai.ai.ga.environment.AbstractEnvironment * */package net.openai.ai.ga.environment;import net.openai.ai.ga.population.*;/** * The <code>AbstractEnvironment</code> is the encapsulation of the problem that * the population will try to solve. This class provides a skeletal * implementation to minimize the effort needed to implement a simple * <code>Environment</code> interface. * * @author	Jared Grubb * @version	%I%, %G% * @since	JDK1.3 */public abstract class AbstractEnvironment implements Environment {    protected int environmentGeneration;    /**     * Tells the <code>AbstractEnvironment</code> to react to the given <code>     * Population</code>. This allows for evolution of the problem model     * according to what its population is. This method is called by a     * <code>World</code> during each Iteration and may also be used as an     * age counter. For many programs, this function may be stubbed {} in     * cases when the problem does not need to evolve.     *     * This skeletal implementation increments a variable, <code>generation     * </code> that stores what generation this class is in.     *     * @param pop	the <code>Population</code> that works on it     */    public void reactToPopulation(Population pop) {        this.environmentGeneration++;    }}/*--- formatting done in "Sun Java Convention" style on 12-28-2000 ---*/

⌨️ 快捷键说明

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