1 | /*
|
---|
2 | Copyright 2006 by Sean Luke
|
---|
3 | Licensed under the Academic Free License version 3.0
|
---|
4 | See the file "LICENSE" for more information
|
---|
5 | */
|
---|
6 |
|
---|
7 |
|
---|
8 | package ec.app.multiplexer.func;
|
---|
9 | import ec.*;
|
---|
10 | import ec.app.multiplexer.*;
|
---|
11 | import ec.gp.*;
|
---|
12 | import ec.util.*;
|
---|
13 |
|
---|
14 | /*
|
---|
15 | * D2.java
|
---|
16 | *
|
---|
17 | * Created: Wed Nov 3 18:26:37 1999
|
---|
18 | * By: Sean Luke
|
---|
19 | */
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * @author Sean Luke
|
---|
23 | * @version 1.0
|
---|
24 | */
|
---|
25 |
|
---|
26 | public class D2 extends GPNode
|
---|
27 | {
|
---|
28 | final static int bitpos = 2; /* D2 */
|
---|
29 |
|
---|
30 | public String toString() { return "d2"; }
|
---|
31 |
|
---|
32 | public void checkConstraints(final EvolutionState state,
|
---|
33 | final int tree,
|
---|
34 | final GPIndividual typicalIndividual,
|
---|
35 | final Parameter individualBase)
|
---|
36 | {
|
---|
37 | super.checkConstraints(state,tree,typicalIndividual,individualBase);
|
---|
38 | if (children.length!=0)
|
---|
39 | state.output.error("Incorrect number of children for node " +
|
---|
40 | toStringForError() + " at " +
|
---|
41 | individualBase);
|
---|
42 | }
|
---|
43 |
|
---|
44 | public void eval(final EvolutionState state,
|
---|
45 | final int thread,
|
---|
46 | final GPData input,
|
---|
47 | final ADFStack stack,
|
---|
48 | final GPIndividual individual,
|
---|
49 | final Problem problem)
|
---|
50 | {
|
---|
51 | MultiplexerData md = (MultiplexerData)input;
|
---|
52 |
|
---|
53 | if (md.status == MultiplexerData.STATUS_3)
|
---|
54 | md.dat_3 = Fast.M_3[bitpos + MultiplexerData.STATUS_3];
|
---|
55 | else if (md.status == MultiplexerData.STATUS_6)
|
---|
56 | md.dat_6 = Fast.M_6[bitpos + MultiplexerData.STATUS_6];
|
---|
57 | else // md.status == MultiplexerData.STATUS_11
|
---|
58 | System.arraycopy(Fast.M_11[bitpos + MultiplexerData.STATUS_11],0,
|
---|
59 | md.dat_11,0,
|
---|
60 | MultiplexerData.MULTI_11_NUM_BITSTRINGS);
|
---|
61 | }
|
---|
62 | }
|
---|
63 |
|
---|
64 |
|
---|
65 |
|
---|