1 10 package org.jgap.gp; 11 12 import org.jgap.*; 13 import org.jgap.impl.*; 14 import org.jgap.gp.function.*; 15 import org.jgap.gp.terminal.*; 16 import org.jgap.gp.impl.*; 17 18 24 public abstract class GPTestCase 25 extends JGAPTestCase { 26 27 protected GPConfiguration m_gpconf; 28 29 protected RandomGeneratorForTest rn; 30 31 protected Constant CMD_CONST0, CMD_CONST1, CMD_CONST2, CMD_CONST3, CMD_CONST4; 32 33 protected Add CMD_ADD; 34 35 protected ForLoop CMD_FOR; 36 protected ForXLoop CMD_FORX; 37 38 protected SubProgram CMD_SUB_V_I, CMD_SUB_V_V_V, CMD_SUB_V_V; 39 40 protected NOP CMD_NOP; 41 42 43 public void setUp() { 44 super.setUp(); 45 try { 46 GPConfiguration.reset(); 47 m_gpconf = new GPConfiguration(); 48 rn = new RandomGeneratorForTest(3); 49 m_gpconf.setRandomGenerator(rn); 50 m_gpconf.setPopulationSize(10); 51 CMD_CONST0 = new Constant(m_gpconf, CommandGene.IntegerClass, 53 new Integer (0)); 54 CMD_CONST1 = new Constant(m_gpconf, CommandGene.IntegerClass, 55 new Integer (1)); 56 CMD_CONST2 = new Constant(m_gpconf, CommandGene.IntegerClass, 57 new Integer (2)); 58 CMD_CONST3 = new Constant(m_gpconf, CommandGene.IntegerClass, 59 new Integer (3)); 60 CMD_CONST4 = new Constant(m_gpconf, CommandGene.IntegerClass, 61 new Integer (4)); 62 CMD_NOP = new NOP(m_gpconf); 63 CMD_FOR = new ForLoop(m_gpconf, CommandGene.IntegerClass, 15); 64 CMD_FORX = new ForXLoop(m_gpconf, CommandGene.IntegerClass); 65 CMD_SUB_V_I = new SubProgram(m_gpconf, 66 new Class [] {CommandGene.VoidClass, 67 CommandGene.IntegerClass}); 68 CMD_SUB_V_V = new SubProgram(m_gpconf, 69 new Class [] {CommandGene.VoidClass, 70 CommandGene.VoidClass}); 71 CMD_SUB_V_V_V = new SubProgram(m_gpconf, 72 new Class [] {CommandGene.VoidClass, 73 CommandGene.VoidClass, 74 CommandGene.VoidClass}); 75 CMD_ADD = new Add(m_gpconf, CommandGene.IntegerClass); 76 } 77 catch (Exception ex) { 78 throw new RuntimeException (ex); 79 } 80 } 81 82 83 84 private static final String CVS_REVISION = "$Revision: 1.3 $"; 85 } 86 | Popular Tags |