Subject: | |
From: | |
Reply To: | |
Date: | Wed, 1 Oct 2008 14:23:23 +0100 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
The short answer is "there will be new constant values".
Assuming that what you want is constants that are randomly initialised
when the node is first created, you can use ERC.java as Keith Sullivan
pointed out.
David
Peter Thieu wrote:
> Hi there
>
> i want leaves with a constant, i.e:
>
> public class Const extends GPNode
> {
> private int cValue;
> public String toString() { return Integer.toString(this.cValue);}
>
> public void checkConstraints(final EvolutionState state,
> final int tree,
> final GPIndividual typicalIndividual,
> final Parameter individualBase)
> {
>
> super.checkConstraints(state,tree,typicalIndividual,individualBase);
> if (children.length!=0)
> state.output.error("Incorrect number of children for node " +
> toStringForError() + " at " +
> individualBase);
> }
>
> public void eval(final EvolutionState state,
> final int thread,
> final GPData input,
> final ADFStack stack,
> final GPIndividual individual,
> final Problem problem)
> {
> DoubleData rd = ((DoubleData)(input));
> this.cValue = ((int)(state.random[thread].nextDouble()*10));
> rd.x = this.cValue;
> }
> }
>
> assuming it creates a tree like (x+2) * 3, where 2 and 3 leaves were
> produced by the class Const
>
> assuming this tree is passed to the next generation, will it be the
> same tree with the same constants (x+2) * 3, or will there be new
> constants values i.e. (x+4) * 5?
>
> kind regards
>
> Peter
--
David R White
Research Student
Department of Computer Science
University of York
York YO10 5DD
United Kingdom
|
|
|