Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/ECJClient/src/ec/app/tutorial4/Mul.java @ 13402

Last change on this file since 13402 was 6152, checked in by bfarka, 14 years ago

added ecj and custom statistics to communicate with the okb services #1441

File size: 1.3 KB
Line 
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
8package ec.app.tutorial4;
9import ec.*;
10import ec.gp.*;
11import ec.util.*;
12
13public class Mul extends GPNode
14    {
15    public String toString() { return "*"; }
16
17    public void checkConstraints(final EvolutionState state,
18        final int tree,
19        final GPIndividual typicalIndividual,
20        final Parameter individualBase)
21        {
22        super.checkConstraints(state,tree,typicalIndividual,individualBase);
23        if (children.length!=2)
24            state.output.error("Incorrect number of children for node " +
25                toStringForError() + " at " +
26                individualBase);
27        }
28    public void eval(final EvolutionState state,
29        final int thread,
30        final GPData input,
31        final ADFStack stack,
32        final GPIndividual individual,
33        final Problem problem)
34        {
35        double result;
36        DoubleData rd = ((DoubleData)(input));
37
38        children[0].eval(state,thread,input,stack,individual,problem);
39        result = rd.x;
40
41        children[1].eval(state,thread,input,stack,individual,problem);
42        rd.x = result * rd.x;
43        }
44    }
45
Note: See TracBrowser for help on using the repository browser.