schrum2 / MM-NEAT

Modular Multiobjective (Hyper) Neuro-Evolution of Augmenting Topologies + MAP-Elites: Java code for evolving intelligent agents in Ms. Pac-Man, Tetris, and more, as well as code for Procedural Content Generation in Mario, Zelda, Minecraft, and more!
http://people.southwestern.edu/~schrum2/re/mm-neat.php
Other
50 stars 20 forks source link

Different Crossover Operator for linear genotypes #887

Closed schrum2 closed 1 year ago

schrum2 commented 1 year ago

I've just uncovered that all experiments are using simple single-point crossover. The NumericArrayGenotype is hard-coded to use ArrayCrossover, which is single-point crossover.

SBX exists in the code, but there is no way to use it, even if it is defined at the crossover class with a command line parameter. Should also add support for multipoint crossover.

schrum2 commented 1 year ago

It is now possible to specify the crossover class for real valued genotypes. I will test with SBX. Afterward, I may still want to add multipoint crossover.

schrum2 commented 1 year ago

SBX test crashed with this error. Very confusing, but no time to look at it now.

java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at edu.southwestern.util.ClassCreation.createObject(ClassCreation.java:75)
        at edu.southwestern.util.ClassCreation.createObject(ClassCreation.java:56)
        at edu.southwestern.util.ClassCreation.createObject(ClassCreation.java:43)
        at edu.southwestern.util.ClassCreation.createObject(ClassCreation.java:28)
        at edu.southwestern.MMNEAT.MMNEAT.loadClasses(MMNEAT.java:478)
        at edu.southwestern.MMNEAT.MMNEAT.run(MMNEAT.java:541)
        at edu.southwestern.MMNEAT.MMNEAT.evolutionaryRun(MMNEAT.java:813)
        at edu.southwestern.MMNEAT.MMNEAT.main(MMNEAT.java:773)
Caused by: java.lang.IndexOutOfBoundsException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.util.concurrent.ForkJoinTask.getThrowableException(Unknown Source)
        at java.util.concurrent.ForkJoinTask.reportException(Unknown Source)
        at java.util.concurrent.ForkJoinTask.invoke(Unknown Source)
        at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(Unknown Source)
        at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
        at java.util.stream.ReferencePipeline.forEach(Unknown Source)
        at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
        at edu.southwestern.evolution.mapelites.MAPElites.initialize(MAPElites.java:380)
        at edu.southwestern.experiment.evolution.SteadyStateExperiment.<init>(SteadyStateExperiment.java:29)
        at edu.southwestern.experiment.evolution.SteadyStateExperiment.<init>(SteadyStateExperiment.java:24)
        ... 12 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.rangeCheck(Unknown Source)
        at java.util.ArrayList.get(Unknown Source)
        at edu.southwestern.tasks.NoisyLonerTask.aggregateResults(NoisyLonerTask.java:244)
        at edu.southwestern.tasks.NoisyLonerTask.evaluate(NoisyLonerTask.java:144)
        at edu.southwestern.evolution.mapelites.MAPElites.lambda$initialize$0(MAPElites.java:381)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
        at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
        at java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source)
        at java.util.concurrent.CountedCompleter.exec(Unknown Source)
        at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source)
        at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
        at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
java.lang.reflect.InvocationTargetException
schrum2 commented 1 year ago

This error was actually a problem with multiobjective optimization ( #884 ) that is now fixed, but now there is a new error:

ERRRORRR:2: -3.6571372478235573 0.0034008391134564553 0.974436548450762

This happens directly inside of SBX and I'm not sure why since most of this code is simply extracted from elsewhere. Need to investigate further.

schrum2 commented 1 year ago

Completely swapped out the SBX implementation with one from a different source (shown in comments). Might work

schrum2 commented 1 year ago

SBX seems to work. Support for multipoint crossover will be a different issue

schrum2 commented 1 year ago

Changed mind and worked on issue here instead. MultipointCrossover is now implemented. Also, an error in SBX was found. It needs to extend MultipointCrossover to work properly, which is now the case.