01: /*
02: * This file is part of JGAP.
03: *
04: * JGAP offers a dual license model containing the LGPL as well as the MPL.
05: *
06: * For licensing information please see the file license.txt included with JGAP
07: * or have a look at the top of class org.jgap.Chromosome which representatively
08: * includes the JGAP license policy applicable for any file delivered with JGAP.
09: */
10: package examples.supergene;
11:
12: import junit.framework.*;
13: import org.jgap.*;
14: import org.jgap.super genes.*;
15:
16: /**
17: * Test Supergene sample application, verifying the "make change"
18: * supergene and non-supergene versions. Both must return a zero error.
19: * Performance is not verified.
20: *
21: * @author Meskauskas Audrius
22: * @since 2.0
23: */
24: public class SupergeneSampleApplicationTest extends JGAPTestCase {
25: /** String containing the CVS revision. Read out via reflection!*/
26: private final static String CVS_REVISION = "$Revision: 1.2 $";
27:
28: public void testSupergeneTotal() {
29: int E_s = Integer.MAX_VALUE;
30: Test: for (int i = 0; i < 2; i++) {
31: AbstractSupergeneTest.EXISTING_SOLUTIONS_ONLY = true;
32: AbstractSupergeneTest.REPORT_ENABLED = false;
33: Force.REPORT_ENABLED = false;
34: AbstractSupergeneTest.MAX_ALLOWED_EVOLUTIONS = 512;
35: AbstractSupergeneTest.POPULATION_SIZE = 256;
36: AbstractSupergene.reset();
37: E_s = new SupergeneSample().test();
38: if (E_s == 0) {
39: break Test;
40: }
41: assertTrue("Correctness of solution: supergene " + E_s,
42: E_s < 3);
43: }
44: assertTrue("Correctness of solution: supergene " + E_s,
45: E_s == 0);
46: }
47:
48: public static Test suite() {
49: TestSuite suite = new TestSuite(
50: SupergeneSampleApplicationTest.class);
51: return suite;
52: }
53: }
|