Your solution space is small (brute force is fine) or you need a mathematically provable optimum (use linear programming instead).

@Override public Individual<Integer> newInstance(Integer genome) return new MySolution(genome);

System.out.println("Best solution found: " + result.bestIndividual()); System.out.println("Fitness: " + result.bestFitness());

// 1. Define the individual (a simple integer gene) public class MySolution implements Individual<Integer> private int value; public MySolution(int val) this.value = val;