diff options
| author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-15 21:43:35 +0000 | 
|---|---|---|
| committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-15 21:45:21 +0000 | 
| commit | e9290a500b228e2561a8537adbc13e86f1356747 (patch) | |
| tree | 5e76280ddefc5bf9dcf9cdb55e80ca4831998115 /src/jcgp/tests/ChromosomeTests.java | |
| parent | afa484021ba94d12e98da682a9ff69c3837d5dbb (diff) | |
Population and Chromosome classes refactored so that EAs are easier to implement.
Diffstat (limited to 'src/jcgp/tests/ChromosomeTests.java')
| -rw-r--r-- | src/jcgp/tests/ChromosomeTests.java | 12 | 
1 files changed, 5 insertions, 7 deletions
diff --git a/src/jcgp/tests/ChromosomeTests.java b/src/jcgp/tests/ChromosomeTests.java index 8092d60..c943da8 100644 --- a/src/jcgp/tests/ChromosomeTests.java +++ b/src/jcgp/tests/ChromosomeTests.java @@ -31,8 +31,7 @@ import org.junit.Test;   *  - It should contain a freely modifiable fitness value.   *  - For truth table evaluations, it should be able to have its inputs set.   *  - For truth table evaluations, the output should return a value according to the inputs. - *  - It should feature a clone constructor, which creates a deep copy of a  - *    specified Chromosome object. + *  - It should feature a copy method, which creates a deep copy of a specified Chromosome object.   *  - It should be able to return a list of active nodes.   *  - It should contain a method to evaluate whether a given chromosome is identical   *    to it. @@ -65,11 +64,11 @@ public class ChromosomeTests {  	@Before  	public void setUp() throws Exception { -		Parameters.setColumns(10); +		Parameters.setColumns(5);  		Parameters.setRows(2);  		Parameters.setInputs(2);  		Parameters.setOutputs(4); -		Parameters.setLevelsBack(10); +		Parameters.setLevelsBack(5);  		chromosome = new Chromosome();  	} @@ -183,10 +182,9 @@ public class ChromosomeTests {  			assertTrue("Connection is not an input.", connectionReturn);  		} -		// get random connections with column 1 -		// they should all be nodes, and their columns should be within range +		// get random connections with the last column as reference, check that they're all within range  		int connectionNodes = 0, connectionOutOfRange = 0, connectionInputs = 0, connectionPicks = 100000; -		int chosenColumn = 1; +		int chosenColumn = Parameters.getColumns() - 1;  		for (int i = 0; i < connectionPicks; i++) {  			Connection c = chromosome.getRandomConnection(chosenColumn);  			if (c instanceof Node) {  | 
