- Easy parametrization with Builders
- A Serial implementation for single-thread environments
- A Parallel implementation for high performance
To build:
- gradle
- java >= 21
Both implementations use a HashMap
to cache the scores of all solutions during execution. You should provide use (as your solutions) classes which can cache their hashCode to speed up the whole process. Take a look at examples Knapsack
and NeuralNetwork
. As you can see here, record classes work fine as wrappers and can inline their hashCode everywhere but be sure to check if the hashCode changes when one of the internal fields/values changes. Otherwise, you should consider using functions which return entirely new instances every time, as mutation and crossover operators.
For a better experience, it is recommended to create a Supplier of small/quick configurations to feed into the same algorithm instance by:
setState
run
getState
to check the results- Return to step 1 if the results are not "good enough"