Ejemplo n.º 1
0
 /**
  * Output null solution should not produce an Exception.
  *
  * @throws Exception
  * @author Klaus Meffert
  * @since 3.3
  */
 public void testOutputSolution_0() throws Exception {
   GPPopulation pop = new GPPopulation(m_gpconf, 2);
   GPProgram prog = new GPProgram(m_gpconf, 2);
   ProgramChromosome chrom = new ProgramChromosome(m_gpconf, 2, prog);
   prog.setChromosome(0, chrom);
   prog.setChromosome(1, chrom);
   pop.setGPProgram(0, prog);
   pop.setGPProgram(1, prog);
   GPGenotype gen = new GPGenotype(m_gpconf, pop, null, null, null, null, null, 1);
   gen.outputSolution(null);
 }
Ejemplo n.º 2
0
 /**
  * @throws Exception
  * @author Klaus Meffert
  * @since 3.0
  */
 public void testConstruct_1() throws Exception {
   GPPopulation pop = new GPPopulation(m_gpconf, 2);
   GPProgram prog = new GPProgram(m_gpconf, 2);
   ProgramChromosome chrom = new ProgramChromosome(m_gpconf, 2, prog);
   prog.setChromosome(0, chrom);
   prog.setChromosome(1, chrom);
   pop.setGPProgram(0, prog);
   pop.setGPProgram(1, prog);
   GPGenotype gen = new GPGenotype(m_gpconf, pop, null, null, null, null, null, 1);
   assertSame(pop, gen.getGPPopulation());
 }
Ejemplo n.º 3
0
 /**
  * @throws Exception
  * @author Klaus Meffert
  * @since 3.0
  */
 public void testSerialize_0() throws Exception {
   GPPopulation pop = new GPPopulation(m_gpconf, 2);
   GPProgram prog = new GPProgram(m_gpconf, 2);
   ProgramChromosome chrom = new ProgramChromosome(m_gpconf, 2, prog);
   prog.setChromosome(0, chrom);
   prog.setChromosome(1, chrom);
   pop.setGPProgram(0, prog);
   pop.setGPProgram(1, prog);
   GPGenotype gen = new GPGenotype(m_gpconf, pop, null, null, null, null, null, 1);
   // Serialize genotype to a file.
   // -----------------------------
   assertEquals(gen, doSerialize(gen));
 }