java实现的遗传算法

源代码在线查看: compositexgene.java.check.txt

软件大小: 656 K
上传用户: z3021440
关键词: java 算法
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*
				 * This file is part of JGAP.
				 *
				 * JGAP offers a dual license model containing the LGPL as well as the MPL.
				 *
				 * For licencing information please see the file license.txt included with JGAP
				 * or have a look at the top of class org.jgap.Chromosome which representatively
				 * includes the JGAP license policy applicable for any file delivered with JGAP.
				 */
				package org.jgap.impl;
				
				import java.io.*;
				import java.net.*;
				import java.util.*;
				
				import org.jgap.*;
				
				/**
				 * Ordered container for multiple genes
				 * Has the same interface as a single gene and could be used accordingly.
				 * Use the addGene(Gene) method to add single genes (not CompositeGenes!) after
				 * construction, an empty CompositeGene without genes makes no sense.
				 * Beware that there are two equalities defined for a CompsoiteGene in respect
				 * to its contained genes:
				 * a) Two genes are (only) equal if they are identical
				 * b) Two genes are (seen as) equal if their equals method returns true
				 *
				 * This influences several methods such as addGene. Notice that it is "better"
				 * to use addGene(a_gene, false) than addGene(a_gene, true) because the second
				 * variant only allows to add genes not seen as equal to already added genes in
				 * respect to their equals function. But: the equals function returns true for
				 * two different DoubleGenes (e.g.) just after their creation. If no specific
				 * (and hopefully different) allele is set for these DoubleGenes they are seen
				 * as equal!
				 *
				 * @author Klaus Meffert
				 * @author Audrius Meskauskas
				 * @since 1.1
				 */
				public class CompositeXGene
				    implements Gene {
				  /** String containing the CVS revision. Read out via reflection!*/
				  private final static String CVS_REVISION = "$Revision: 1.19 $";
				
				  /**
				   * This field separates gene class name from
				   * the gene persistent representation string.
				   * '*' does not work properly with URLEncoder, so I have changed it to '#'
				   */
				  public final static String GENE_DELIMITER = "#";
				  /**
				   * Represents the heading delimiter that is used to separate genes in the
				   * persistent representation of CompositeGene instances.
				   */
				  public final static String GENE_DELIMITER_HEADING = "				
				  /**
				   * Represents the closing delimiter that is used to separate genes in the
				   * persistent representation of CompositeGene instances.
				   */
				  public final static String GENE_DELIMITER_CLOSING = ">";
				
				  /**
				   * This field separates the gene label from the gene persistent representation
				   * string.
				   */
				
				  public final static String GENE_LABEL_DELIMITER = "			

相关资源