ga4robot
类 Chromosome

java.lang.Object
  继承者 ga4robot.Chromosome

public class Chromosome
extends java.lang.Object

染色体


构造方法摘要
Chromosome(int n)
          染色体构造函数
 
方法摘要
 void addGene(int id, Gene gene)
          在 id 位上添加基因 gene
 Chromosome clone()
          重载 clone 方法
 java.util.ArrayList<Chromosome> crossover(Chromosome chromosome)
          交叉
 double evaluation()
          评估函数
 Gene getGene(int id)
          获取 id 位的基因
 void mutation()
          变异
 void setGene(int id, Gene gene)
          在 id 位上设置基因 gene
 
从类 java.lang.Object 继承的方法
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

Chromosome

public Chromosome(int n)
染色体构造函数

参数:
n - 基因位数目
方法详细信息

setGene

public void setGene(int id,
                    Gene gene)
在 id 位上设置基因 gene

参数:
id - 基因位
gene - 基因

addGene

public void addGene(int id,
                    Gene gene)
在 id 位上添加基因 gene

参数:
id - 基因位
gene - 基因

getGene

public Gene getGene(int id)
获取 id 位的基因

参数:
id - 基因位
返回:
基因

clone

public Chromosome clone()
重载 clone 方法

覆盖:
java.lang.Object 中的 clone
返回:
染色体

crossover

public java.util.ArrayList<Chromosome> crossover(Chromosome chromosome)
交叉

参数:
chromosome - 与当前染色体交叉的令一染色体
返回:
交叉得到新的两条染色体

mutation

public void mutation()
变异


evaluation

public double evaluation()
评估函数

返回:
评估函数值