Package org.jgap

Examples of org.jgap.Gene


            continue;
          IChromosome chromosome = (IChromosome) ((ICloneable) arg0.getChromosome(i)).clone();
          Gene[] beforeArray = chromosome.getGenes();
          int randomPoint = (int) (Math.random() * beforeArray.length);
          int randomPoint2 = (int) (Math.random() * beforeArray.length);
          Gene swap = beforeArray[randomPoint];
          beforeArray[randomPoint] = beforeArray[randomPoint2];
          beforeArray[randomPoint2] = swap;
          try
          {
            chromosome.setGenes(beforeArray);
View Full Code Here


          IChromosome chromosome = (IChromosome) ((ICloneable) arg0.getChromosome(i)).clone();
          Gene[] beforeArray = chromosome.getGenes();
          int randomPoint = (int) (Math.random() * beforeArray.length);
          if (randomPoint < beforeArray.length - 1)
          {
            Gene swap = beforeArray[randomPoint];
            beforeArray[randomPoint] = beforeArray[randomPoint + 1];
            beforeArray[randomPoint + 1] = swap;
          }
          try
          {
View Full Code Here

        VecInstruction inst = null;

        for (int i = 0; i < program.size(); i++) {

            Gene g = program.get(i);

            if (g instanceof IntegerGene) {
                IntegerGene ig = (IntegerGene) g;
                inst = IntegerInstructionGene.getInstruction(ig.intValue(),
                        size);
View Full Code Here

    this.size=size;
  }
 
  public Gene getInstance(Configuration gaConf) throws InvalidConfigurationException{
   
    Gene ret = null;
                switch(type){
                    case INTEGER:
                        return new IntegerInstructionGene(gaConf,size);
                    case SYMBOL:
                        return new SymbolInstructionGene(gaConf,size);
View Full Code Here

TOP

Related Classes of org.jgap.Gene

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.