亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? geneticalgorithm.java

?? 遺傳算法源代碼,實現了選擇操作、交叉操作和變異操作
?? JAVA
字號:
/*--- formatted by Jindent 2.1, (www.c-lab.de/~jindent) ---*//** * GeneticAlgorithm * * location: net.openai.ai.ga.GenteticAlgorithm * */package net.openai.ai.ga;import net.openai.ai.ga.world.*;import java.util.Collection;import java.util.ArrayList;import java.util.Iterator;import java.util.NoSuchElementException;/** * GeneticAlgorithm is the top-level class for the Genetic Algorithm Java * implementation of the OpenAI Toolkit. It provides the handling * of multiple worlds (isolated genetic algorithm implementations) and making * the algorithms run. * * @author	Jared Grubb * @version	%I%, %G% * @since	JDK1.3 */public class GeneticAlgorithm {    /**     * Controls whether     */    private static boolean debug = true;    /**     * The collection of all the World objects in this GeneticAlgorithm.     * Since World's are stored as Object's, it is important to keep this     * list private to avoid adding non-World objects to this list     */    private Collection worlds;    /**     * Initializes the GeneticAlgorithm with an <code>ArrayList</code>     */    public GeneticAlgorithm() {	this(new ArrayList());    }    /**     * Initializes the GeneticAlgorithm with the specified <code>     * Collection</code>     */    public GeneticAlgorithm(Collection initialCollection) {	worlds = initialCollection;    }    /**     * Adds a given World onto the end of all the worlds in this     * Genetic Algorithm.     *     * @param toAdd a World to be added into this GeneticAlgorithm     */    public void addWorld(World toAdd) {	worlds.add(toAdd);    }    /**     * Removes a given World out of this GeneticAlgorithm. Returns true     * when it can successfully remove the given World. When multiple copies     * of the given World exist, only the first instance is deleted. This     * method does not throw an IndexOutOfBoundsException.     *     * @param toRemove	a World to be deleted from this GeneticAlgorithm     * @return 		<code>true</code> if the World has been found and     *                  deleted<br>     *                  <code>false</code> otherwise     */    public boolean removeWorld(World toRemove) {	return worlds.remove(toRemove);    }    /**     * Removes a World with the given name out of this GeneticAlgorithm.     * Returns true when it can successfully remove the given World. When     * multiple copies of the given World exist, only the first instance is     * deleted. This method does not throw an IndexOutOfBoundsException. This     * method uses getWorld(String) to find the given World.     *     * @param name	a String specifying the name of the world to be deleted     * @return 		<code>true</code> if the World has been found and     *                  deleted<br>     *                  <code>false</code> otherwise     */    public boolean removeWorld(String name) {	return removeWorld(getWorld(name));    }    /**     * Removes all World's with the given name out of this GeneticAlgorithm.     * This method does not throw an IndexOutOfBoundsException. This     * method uses removeWorld(String) to delete all World's with the given     * name and keeps calling until removeWorld(String) returns false. Does     * not return a value.     *     * @param name	a String specifying the name of the world to be deleted     */    public void removeAllWorlds(String name) {	while (removeWorld(name));    }    /**     * Retrieves a World from the list with a given name. Iterates through     * all the World's in this GeneticAlgorithm until one is found that has     * the given name. Returns the World when one is found; returns null when     * the search is unsuccessful.     *     * @param name	a String specifying the name of the world to be returned     * @return		<code>Object</code> when a match is found<br>     *                  <code>null</code> when no match can be found     */    public World getWorld(String name) {	World w;	for (Iterator i = getWorldIterator(); i.hasNext(); ) {	    w = (World) i.next();	    if (name.equals(w.getName())) {		return w;	    }	}	return null;    }    /**     * Retrieves a World from the list with a given name. Iterates through     * all the World's in this GeneticAlgorithm until one is found that has     * the given name. Returns the World when one is found; returns null when     * the search is unsuccessful.     *     * @param name	a String specifying the name of the world to be returned     * @return		<code>Object</code> when a match is found<br>     *                  <code>null</code> when no match can be found     */    public String[] getWorldNames() {	String[] names = new String[worlds.size()];	int      ctr = 0;	for (Iterator i = getWorldIterator(); i.hasNext(); ) {	    names[ctr++] = ((World) (i.next())).getName();	}	return names;    }    /**     * Retrieves a World[] copy of all the World's in this GeneticAlgorithm.     * The order is not guaranteed to be consistant on every call.     *     * @return		<code>World[]</code> of all the World objects     */    public World[] getWorldArray() {	return (World[]) (worlds.toArray(new World[0]));    }    /**     * Retrieves the <code>Collection</code> that holds this collection's     * <code>World</code> objects     *     * @return		<code>Collection</code> of all the World objects     */    public Collection getWorlds() {	return worlds;    }    /**     * Tells a World with a given name to iterate through one generation. Uses     * getWorld(String) to find the World with the given name and calls that     * World's iterate() function.     *     * @param name	a String specifying the name of the world to iterate()     */    public void iterateWorld(String name) {	iterateWorld(getWorld(name));    }    /**     * Tells a World to iterate through one generation. Equilivant to calling     * the iterate() function of the given World. Throws an exception when     * the World does not belong to its collection.     *     * @param toIterate		a World to iterate     * @throws NoSuchElementException thrown if the specified <code>World</code>     *          does not belong to this <code>GeneticAlgorithm</code>     */    public void iterateWorld(World toIterate) {	if (worlds.contains(toIterate)) {	    iterate_Unconditional(toIterate);	} else {	    throw new NoSuchElementException(	        "World does not exist in GeneticAlgorithm");	}    }    /**     * Tells a World to iterate through multiple generations. Calls     * getWorld(name) to retrieve the World from the collection and then     * calls the iterate() function on it a given number of times. Does not     * iterate when called with a non-positive number. Does no iterations     * when no world with the given name can be found.     *     * @param name	a String specifying a world to iterate     * @param reps	the number of times to iterate     */    public void iterateWorld(String name, int reps) {	World w = getWorld(name);	if (w==null) return;	for (int i = 0; i < reps; i++) {	    iterate_Unconditional(w);	}    }    /**     * Tells a World to iterate through multiple generations. Calls     * getWorld(name) to retrieve the World from the collection and then     * calls the iterate() function on it a given number of times. Does not     * iterate when called with a non-positive number. Throws an exception     * when the World does not belong to its collection.     *     * @param toIterate	the <code>World</code> to iterate     * @param reps	the number of times to iterate     * @throws NoSuchElementException thrown if the specified <code>World</code>     *          does not belong to this <code>GeneticAlgorithm</code>     */    public void iterateWorld(World toIterate, int reps) {	if (worlds.contains(toIterate)==false) {	    throw new NoSuchElementException(	        "World does not exist in GeneticAlgorithm");	}	for (int i = 0; i < reps; i++) {	    iterate_Unconditional(toIterate);	}    }    /**     * Tells all World's in this GeneticAlgorithm to iterate through one     * generation. Uses getWorldIterator() to iterate through each call,     * and therefore does not guarantee any order of execution.     */    public void iterateAllWorlds() {	for (Iterator i = getWorldIterator(); i.hasNext(); ) {	    iterate_Unconditional((World) (i.next()));	}    }    /**     * Tells all World's in this GeneticAlgorithm to iterate through multiple     * generations. There are two methods of iteration:     * <ul>     *   <li>Serially - Each world is iterated the complete number of times     *          before the next world is iterated even once.     *   <li>Parallelly - Each world is iterated once before any other world     *          gets to iterate again.     * </ul>     * @param reps		the number of times to iterate each world     * @param iterateParallel <code>false</code> specifies serial iteration     *                          (all iterations on each world)<br>     *                         <code>true</code> specifies parallel iteration     *                          (each iteration simultaneously on all worlds)     */    public void iterateAllWorlds(int reps, boolean iterateParallel) {	if (iterateParallel == true) {	    for (int i = 0; i < reps; i++) {		iterateAllWorlds();	    }	} else {	    for (Iterator i = getWorldIterator(); i.hasNext(); ) {		iterateWorld((World) (i.next()), reps);	    }	}    }    /**     * Internal. Iterates the World without checking whether it's part of the     * collection. Called from all public iterate methods.     *     * @param toIterate	the World to iterate once     */    private void iterate_Unconditional(World toIterate) {	toIterate.iterate();    }    /**     * Returns the number of <code>World</code>s stored in this <code>     * GeneticAlgorithm</code>.     *     * @return	the number of <code>World</code>s     */    public int getNumberOfWorlds() {	return worlds.size();    }    /**     * Calls every <code>World<code>'s <code>toString()</code> method and     * returns a concatenation of all the <code>String</code>s returned.     *     * @return a concatenated <code>String</code> of all the <code>World</code>s'     *           <code>toString()</code> methods     */    public String toString() {	StringBuffer sb = new StringBuffer("");	for (Iterator i = getWorldIterator(); i.hasNext(); ) {	    sb.append((World) (i.next())).append(";");	}	return sb.toString();    }    /**     * Removes non-<code>World</code> objects from the <code>Collection     * </code>     */    public void cleanse() {	World w;	for (Iterator i = getWorldIterator(); i.hasNext(); ) {	    try {	    	w = (World) i.next();	    } catch (ClassCastException e) {	    	i.remove();	    }	}    }    /**     * Return an <code>Iterator</code> to use to go through all the <code>     * World</code>s in this <code>GeneticAlgorithm</code>.     *     * @return an <code>Iterator</code> for the collection of <code>World</code>s     */    public Iterator getWorldIterator() {	return worlds.iterator();    }    private static void db(String message) {    	if (GeneticAlgorithm.getDebug()) {    	    System.err.println("GA: " + message);    	}    }    public static boolean getDebug() {return debug;}}/*--- formatting done in "Sun Java Convention" style on 12-28-2000 ---*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费在线观看| 中文字幕va一区二区三区| 99久久99久久久精品齐齐| 国产精品一区二区在线观看网站| 日韩高清不卡一区二区三区| 日韩精品一级二级 | 色婷婷精品大视频在线蜜桃视频| 久久国产成人午夜av影院| 日韩激情中文字幕| 日本中文字幕一区二区视频| 蜜桃精品在线观看| 另类小说色综合网站| 国产精品99久| 懂色av一区二区夜夜嗨| 成人福利在线看| 91福利社在线观看| 欧美日韩国产美女| 亚洲精品一线二线三线| 久久久综合激的五月天| 欧美国产成人精品| 一区二区日韩电影| 免费精品视频最新在线| 国产suv精品一区二区6| 91传媒视频在线播放| 欧美久久一区二区| 国产亚洲短视频| 综合久久久久综合| 日本不卡免费在线视频| 狠狠色狠狠色综合系列| 99国产精品国产精品毛片| 欧美日韩不卡视频| 久久一夜天堂av一区二区三区| 欧美国产精品一区| 日韩一区精品字幕| 92精品国产成人观看免费| 在线免费观看视频一区| 精品乱码亚洲一区二区不卡| 一区二区三区日韩精品视频| 国产成人午夜高潮毛片| 欧美日韩综合色| 国产女人水真多18毛片18精品视频| 亚洲一二三区在线观看| 东方欧美亚洲色图在线| 欧美久久免费观看| 国产精品精品国产色婷婷| 久久av资源网| 欧美午夜精品久久久久久超碰| 久久久久久久精| 日日夜夜免费精品| 欧洲日韩一区二区三区| 欧美国产禁国产网站cc| 久久精品国产精品亚洲综合| 欧美日韩在线播放三区四区| 国产精品乱码久久久久久| 久久精品国产精品青草| 欧美日韩久久不卡| 亚洲久本草在线中文字幕| 国产福利一区二区三区视频在线| 欧美一区二区三区视频免费| 亚洲aⅴ怡春院| 色综合久久久久综合99| 国产精品欧美久久久久无广告| 精品一区二区成人精品| 欧美一区二区三区影视| 五月天亚洲婷婷| 欧美性感一类影片在线播放| 亚洲综合小说图片| 色综合天天综合网天天狠天天 | 日韩一区在线播放| 国产黄人亚洲片| 久久中文字幕电影| 久久精品国产成人一区二区三区 | 成人午夜在线免费| 久久久久久久久久久久电影| 国产一区二区三区av电影 | 日韩美女视频19| aaa亚洲精品| 亚洲视频在线观看三级| 日本精品一区二区三区高清 | 日本不卡一二三| 日韩网站在线看片你懂的| 日本不卡视频一二三区| 91精品国产综合久久久久久 | 色婷婷综合视频在线观看| 国产精品久久久久久久久免费相片| 国产经典欧美精品| 日韩毛片精品高清免费| 色综合久久中文综合久久牛| 亚洲一区二区在线视频| 欧美日韩1234| 精品亚洲aⅴ乱码一区二区三区| 精品国产乱码久久久久久牛牛| 国产真实乱偷精品视频免| 中文字幕二三区不卡| 91蜜桃婷婷狠狠久久综合9色| 一区二区三区资源| 欧美日韩国产综合一区二区| 另类小说欧美激情| 国产精品乱码人人做人人爱| 欧美在线观看视频在线| 奇米亚洲午夜久久精品| 国产欧美在线观看一区| 色综合久久六月婷婷中文字幕| 亚洲成人资源网| 精品区一区二区| 97成人超碰视| 全国精品久久少妇| 亚洲国产精品99久久久久久久久| 欧美综合天天夜夜久久| 欧美a一区二区| 国产精品国产自产拍高清av | 99久久国产综合精品麻豆| 亚洲va国产天堂va久久en| 久久奇米777| 日本道精品一区二区三区| 精品在线播放免费| 亚洲伦理在线免费看| 日韩欧美一区二区免费| 一本色道久久综合亚洲91| 精品一区二区在线免费观看| 亚洲一区二区在线视频| 国产日产欧美精品一区二区三区| 欧美日本一区二区三区四区| 成人免费福利片| 韩国成人在线视频| 最新热久久免费视频| 久久精品人人做人人综合| 欧美日韩精品专区| 91视频观看视频| 豆国产96在线|亚洲| 日本在线不卡一区| 一区二区三区四区激情| 国产精品白丝在线| 久久一日本道色综合| 日韩一级大片在线| 欧日韩精品视频| a级精品国产片在线观看| 国产一区二区不卡在线| 蜜桃免费网站一区二区三区| 亚洲成人免费看| 亚洲午夜一区二区三区| 亚洲精品国产无天堂网2021| 亚洲欧美另类在线| 亚洲欧美综合另类在线卡通| 国产精品污www在线观看| 久久午夜国产精品| 日韩一区二区三区av| 6080亚洲精品一区二区| 在线不卡中文字幕| 欧美日本一区二区在线观看| 欧美日韩情趣电影| 在线亚洲一区二区| 欧美亚洲综合网| 在线免费精品视频| 欧美日韩国产在线播放网站| 欧美日免费三级在线| 精品视频一区三区九区| 欧美日本一区二区在线观看| 51精品久久久久久久蜜臀| 91精品国产综合久久精品性色| 在线综合+亚洲+欧美中文字幕| 欧美一区日本一区韩国一区| 精品福利av导航| 国产日韩欧美不卡| 亚洲老妇xxxxxx| 午夜精品123| 老司机精品视频一区二区三区| 国产一区二区三区精品视频| bt7086福利一区国产| 欧美优质美女网站| 欧美一区二区三区公司| 精品国产一区二区精华| 久久精品夜色噜噜亚洲a∨| 国产嫩草影院久久久久| 国产精品国产成人国产三级| 亚洲中国最大av网站| 蜜桃视频在线观看一区| 成人一区二区三区视频 | av电影在线观看完整版一区二区| 亚洲va天堂va国产va久| 青青草视频一区| 国产精品996| 欧美综合天天夜夜久久| 日韩欧美在线观看一区二区三区| 国产三级欧美三级| 亚洲另类中文字| 日本午夜一区二区| 成人免费视频一区| 欧美在线free| 久久婷婷久久一区二区三区| 亚洲视频在线观看三级| 日韩和欧美的一区| 成人免费高清在线| 欧美一卡2卡3卡4卡| 综合在线观看色| 热久久免费视频| 色天使色偷偷av一区二区| 精品精品国产高清一毛片一天堂| 亚洲欧美日韩在线| 黄色日韩三级电影|