⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.java

📁 遗传算法源代码,实现了选择操作、交叉操作和变异操作
💻 JAVA
字号:
/*--- 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -