[jgap-users] Salesman: exception thrown when running algorithm twice in a program.
Brought to you by:
klausikm
From: Mark S. <mar...@ya...> - 2006-09-19 13:07:41
|
Hello. I have a problem with Salesman class of JGAP. I have a subclass that works fine when I run the algorithm once, but if I run it again in the program, exceptions are thrown: java.lang.RuntimeException: Fitness evaluator has already been set differently. Maybe org.jgap.DefaultFitnessEvaluator.hashCode() is not implemented accordingly. at org.jgap.Configuration.checkProperty(Configuration.java:459) at org.jgap.Configuration.setFitnessEvaluator(Configuration.java:1166) at org.jgap.impl.salesman.Salesman.createConfiguration(Salesman.java:132) at org.jgap.impl.salesman.Salesman.findOptimalPath(Salesman.java:218) I tried to use a static FitnessEvaluator so it "is not set differently", but I get similar exceptions with FitnessFunction, Chromosome etc. Looking up in the code, I see that a System property is set and if it is changed the exception is thrown. I don't understand the purpose of that, but I makes impossible to run more than once the algorithm. So how can I run Salesman.findOptimalPath() twice in a program? Thanks! --------------------------------- Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail. |