|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
ADFs with argumentType =/= returnTypeHi,
I'm using JGAP with one ADF with the following configuration: Class[] types = { CommandGene.VoidClass, CommandGene.BooleanClass }; Class[][] argTypes = {{}, CommandGene.LongClass,CommandGene.LongClass}}; // Configure desired minimum number of nodes per sub program. // Same as with types: First entry here corresponds with first entry in // nodeSets. int[] minDepths = new int[]{2, 1}; // Configure desired maximum number of nodes per sub program. // First entry here corresponds with first entry in nodeSets. int[] maxDepths = new int[]{6, 20}; GPConfiguration conf = getGPConfiguration(); CommandGene[][] nodeSets = {{ X = Variable.create(conf, "X", CommandGene.LongClass), new SubProgram(conf, new Class[]{ CommandGene.VoidClass, CommandGene.VoidClass }, true), new MyFunct(conf, CommandGene.VoidClass /*this is returntype*/), new IfElse(conf, CommandGene.BooleanClass), new Equals(conf, CommandGene.DoubleClass), new GreaterThan(conf, CommandGene.DoubleClass), new Terminal(conf, CommandGene.DoubleClass, 0L, 10L), new it.unitary.gp.functions.Add(conf, 2, CommandGene.LongClass, 0, new int[]{0, 1}), new ADF(conf, 1, 2) }, { new GreaterThan(conf, CommandGene.LongClass), new Terminal(conf, CommandGene.LongClass, -1800000, 0, true, 1), new Equals(conf, CommandGene.LongClass), new Not(conf), new Or(conf), new And(conf), new GetAverage(conf, jdbcDao, 60000, 0, null) } }; While evolving generation 0 it casts the following exception: [JGAP][11:02:49] INFO GPGenotype - Evolving generation 0, memory free: 3.9 MB Exception in thread "main" java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Boolean at org.jgap.gp.terminal.Variable.execute_boolean(Variable.java:71) at org.jgap.gp.impl.ProgramChromosome.execute_boolean(ProgramChromosome.java:951) at org.jgap.gp.function.ADF.execute_boolean(ADF.java:97) at org.jgap.gp.impl.ProgramChromosome.execute_boolean(ProgramChromosome.java:951) at org.jgap.gp.function.IfElse.execute_void(IfElse.java:64) at org.jgap.gp.impl.ProgramChromosome.execute_void(ProgramChromosome.java:977) at org.jgap.gp.function.IfElse.execute_void(IfElse.java:82) at org.jgap.gp.impl.ProgramChromosome.execute_void(ProgramChromosome.java:967) at org.jgap.gp.impl.GPProgram.execute_void(GPProgram.java:465) at it.unitary.gp.test.AgentFitnessFunction.evaluate(AgentFitnessFunction.java:64) at org.jgap.gp.GPFitnessFunction.getFitnessValue(GPFitnessFunction.java:64) at org.jgap.gp.GPProgramBase.calcFitnessValue(GPProgramBase.java:133) at org.jgap.gp.GPProgramBase.getFitnessValue(GPProgramBase.java:154) at org.jgap.gp.impl.DefaultGPFitnessEvaluator.isFitter(DefaultGPFitnessEvaluator.java:73) at org.jgap.gp.impl.TournamentSelector.select(TournamentSelector.java:97) at org.jgap.gp.impl.GPGenotype.evolve(GPGenotype.java:682) at org.jgap.gp.impl.GPGenotype.evolve(GPGenotype.java:495) at it.unitary.gp.test.Main.evolve(AIMain.java:106) at it.unitary.gp.test.Main.main(AIMain.java:95) I have two questions: 1) why ADF has Variable as a child? The only Variable is in the first chromosome, so as long as I understand correctly it shouldn't be called by the ADF. Maybe Variable its the external argument? 2) why ADF has a Long child and calls its execute_boolean? I expected something like ADF := 5>X, with 5 and X provided by the "main" chromosome as arguments. TIA, Simone ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ jgap-users mailing list jgap-users@... https://lists.sourceforge.net/lists/listinfo/jgap-users |
|
|
Re: ADFs with argumentType =/= returnTypeSimone,
Regarding your questions: 1) It's not Variable specifically. You defined as return type a boolean for the ADF (second sub program). For the ADF there seems to be no terminal with return type boolean. It's currently necessary to have such to allow for creating valid GP programs. However, I cannot analyze deeper without full source code. Maybe there is something in the fitness function? 2) Childs with type long are defined in the second sub program. As in 1) I cannot analyze deeper without source code. If your problems still persist, could you kindly send me a running (maybe reduced) version of your code that reproduces the problem? Best Klaus www.klaus-meffert.com > -----Original Message----- > From: Simone Bronzin [mailto:simone.bronzin@...] > Sent: Thursday, May 07, 2009 11:44 AM > To: jgap-users@... > Subject: [jgap-users] ADFs with argumentType =/= returnType > > Hi, > > I'm using JGAP with one ADF with the following configuration: > > Class[] types = { > CommandGene.VoidClass, > CommandGene.BooleanClass > }; > Class[][] argTypes = {{}, > CommandGene.LongClass,CommandGene.LongClass}}; > // Configure desired minimum number of nodes per sub program. > // Same as with types: First entry here corresponds > with first entry in > // nodeSets. > int[] minDepths = new int[]{2, 1}; > // Configure desired maximum number of nodes per sub program. > // First entry here corresponds with first entry in nodeSets. > int[] maxDepths = new int[]{6, 20}; > GPConfiguration conf = getGPConfiguration(); > > CommandGene[][] nodeSets = {{ > X = Variable.create(conf, "X", CommandGene.LongClass), > new SubProgram(conf, new Class[]{ > CommandGene.VoidClass, > CommandGene.VoidClass > }, true), > new MyFunct(conf, CommandGene.VoidClass /*this is > returntype*/), > new IfElse(conf, CommandGene.BooleanClass), > new Equals(conf, CommandGene.DoubleClass), > new GreaterThan(conf, CommandGene.DoubleClass), > new Terminal(conf, CommandGene.DoubleClass, 0L, 10L), > new it.unitary.gp.functions.Add(conf, 2, > CommandGene.LongClass, 0, new int[]{0, 1}), > new ADF(conf, 1, 2) > > }, { > new GreaterThan(conf, CommandGene.LongClass), > new Terminal(conf, CommandGene.LongClass, -1800000, > 0, true, 1), > new Equals(conf, CommandGene.LongClass), > new Not(conf), > new Or(conf), > new And(conf), > new GetAverage(conf, jdbcDao, 60000, 0, null) > } > > }; > > While evolving generation 0 it casts the following exception: > > > [JGAP][11:02:49] INFO GPGenotype - Evolving generation 0, > memory free: 3.9 MB Exception in thread "main" > java.lang.ClassCastException: > java.lang.Long cannot be cast to java.lang.Boolean > at > org.jgap.gp.terminal.Variable.execute_boolean(Variable.java:71) > at > org.jgap.gp.impl.ProgramChromosome.execute_boolean(ProgramChro > mosome.java:951) > at org.jgap.gp.function.ADF.execute_boolean(ADF.java:97) > at > org.jgap.gp.impl.ProgramChromosome.execute_boolean(ProgramChro > mosome.java:951) > at org.jgap.gp.function.IfElse.execute_void(IfElse.java:64) > at > org.jgap.gp.impl.ProgramChromosome.execute_void(ProgramChromos > ome.java:977) > at org.jgap.gp.function.IfElse.execute_void(IfElse.java:82) > at > org.jgap.gp.impl.ProgramChromosome.execute_void(ProgramChromos > ome.java:967) > at > org.jgap.gp.impl.GPProgram.execute_void(GPProgram.java:465) > at > it.unitary.gp.test.AgentFitnessFunction.evaluate(AgentFitnessF > unction.java:64) > at > org.jgap.gp.GPFitnessFunction.getFitnessValue(GPFitnessFunctio > n.java:64) > at > org.jgap.gp.GPProgramBase.calcFitnessValue(GPProgramBase.java:133) > at > org.jgap.gp.GPProgramBase.getFitnessValue(GPProgramBase.java:154) > at > org.jgap.gp.impl.DefaultGPFitnessEvaluator.isFitter(DefaultGPF > itnessEvaluator.java:73) > at > org.jgap.gp.impl.TournamentSelector.select(TournamentSelector.java:97) > at org.jgap.gp.impl.GPGenotype.evolve(GPGenotype.java:682) > at org.jgap.gp.impl.GPGenotype.evolve(GPGenotype.java:495) > at it.unitary.gp.test.Main.evolve(AIMain.java:106) > at it.unitary.gp.test.Main.main(AIMain.java:95) > > I have two questions: > > 1) why ADF has Variable as a child? The only Variable is in > the first chromosome, so as long as I understand correctly it > shouldn't be called by the ADF. Maybe Variable its the > external argument? > 2) why ADF has a Long child and calls its execute_boolean? I > expected something like ADF := 5>X, with 5 and X provided by > the "main" > chromosome as arguments. > > TIA, > > Simone > > > -------------------------------------------------------------- > ---------------- > The NEW KODAK i700 Series Scanners deliver under ANY > circumstances! Your production scanning environment may not > be a perfect world - but thanks to Kodak, there's a perfect > scanner to get the job done! With the NEW KODAK i700 Series > Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodak-com > _______________________________________________ > jgap-users mailing list > jgap-users@... > https://lists.sourceforge.net/lists/listinfo/jgap-users ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ jgap-users mailing list jgap-users@... https://lists.sourceforge.net/lists/listinfo/jgap-users |
| Free embeddable forum powered by Nabble | Forum Help |