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

Maximize Volume Fitness #871

Closed schrum2 closed 1 year ago

schrum2 commented 1 year ago

It seems like the big flying machines only use a portion of their blocks to make a flying machine. This is disappointing, but it begs the question of if there are enough blocks to make machines flying in different directions.

Make a new fitness function MaximizeVolumeFitness that extends the TimedEvaluationMinecraftFitnessFunction that is being made #870 . The calculateFinalScore method within it will be defined to look over all blocks in all shapes in the history and calculate the minimum and maximum x, y, and z coordinates. The goal is to figure out the size of the space that the shape encompasses.

The final fitness will be the difference in max/min x, multiplied by the differences in max/min y and max/min z.

schrum2 commented 1 year ago

This should be easier than some of the other fitness function tasks you have assigned. Just be sure to make use of what @JoannaBlatt has produced in #870 . You may need to merge the latest version of dev_Joanna before starting on this.

TjRaffert commented 1 year ago

Created fitness function for rewarding Volume created MaximizeVolumeFitness. I also added maxCoordinates in the MinecraftUtilClass to be used on MaximizeVolumeFitness.

schrum2 commented 1 year ago

Let's keep this issue open until you have successfully run some experiments based on a batch file that uses this new fitness function

TjRaffert commented 1 year ago

I ran it on several machines and didn't get any flying machines. I believe this is because it encourages filling the cube with as many blocks as possible. This makes it harder for a flying machine to appear because the shape will almost immediately exceed the max block count of a single piston.

schrum2 commented 1 year ago

I think the fitness function we are using here makes sense, so we need to think of different behavior characterizations that could help. Perhaps one dimension of a behavior characterization could be based on the amount of movement the shape exhibits. If we can get this idea out of the brainstorming phase, then it deserves its own issue

TjRaffert commented 1 year ago

I ran MaxVolume it had no flying machines maxed out its space early on. Fitness never exceeds 500 which is what we saw with earlier tests. But it had encouraging oscillating behavior that we can reward to hopefully get bigger or more flying machines.

TjRaffert commented 1 year ago

I ran 2 MaxVolume10Dim. Neither machine has finished yet, but it is pretty clear to see that they are just pushing out as much as they can in each direction.

TjRaffert commented 1 year ago

MaxVolume10Dim never had fitness of 900 or above.

schrum2 commented 1 year ago

It's clear that we are failing to evolve flying machines with this fitness function, and we have already hypothesized that encouraging movement could help. However, first I want to verify that if we had flying machines, that they should earn a high fitness score. In particular, one shape that produces machines flying in two different directions should earn a high score, but to start simple let's just work with a machine flying in one direction.

I've transferred this to @JoannaBlatt since she already has some experience with these unit tests. Make a unit test for this fitness function (MaximizeVolumeFitness) that verifies the fitness assigned to a regular flying machine makes sense. Once that works, have a shape that instantiated flying machines in two different directions, and verify that the resulting fitness is even higher!

schrum2 commented 1 year ago

Can't actually do this until #888 is fixed

schrum2 commented 1 year ago

This seems to have been fixed, but all previous preliminary results are invalidated. In fact, I think an actual flying machine could have earned a low fitness due to the previous error. So, we need to re-run experiments with maximize volume to see how it does.

schrum2 commented 1 year ago

Clarification for @JoannaBlatt regarding what is required before this issue can be closed:

Make a unit test for this fitness function (MaximizeVolumeFitness). First verify the fitness for a static shape. Then verify the fitness assigned to a regular flying machine makes sense. Once that works, have a shape that instantiates flying machines in two different directions, and verify that the resulting fitness is even higher!

Side note: combining maximize volume with change in center of mass via multiobjective evolution seems to have made some larger flying machines. So, all we need is unit tests, and then I'm ok closing this.

JoannaBlatt commented 1 year ago

Unit tests finished and functional.