test.java

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

JAVA
50
字号
/*--- formatted by Jindent 2.1, (www.c-lab.de/~jindent) ---*/import net.openai.ai.ga.cell.encoding.StrictPermutation;/** * Class declaration * * * @author * @version %I%, %G% */public class test {    /**     * Method declaration     *     *     * @param s     *     * @see     */    public static void main(String s[]) {	int[]		  i = {	    0, 5, 7, 4, 3, 2, 1, 6	};	int[]		  j = {	    2, 4, 6	};	StrictPermutation p1 = new StrictPermutation("", 8, i);	StrictPermutation p2 = new StrictPermutation("", 8, j);	System.out.println(p1);	System.out.println(p2);	System.out.println("-------------");	System.out.println(p1.cross(p1, p2));	System.out.println(p1.cross(p1, p2));	System.out.println(p1.cross(p1, p2));	System.out.println(p2.cross(p2, p1));	System.out.println("-------------");	p1.mutate(1);	System.out.println(p1);    } }/*--- formatting done in "Sun Java Convention" style on 12-28-2000 ---*/

⌨️ 快捷键说明

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