IBM ILOG Solver User's Manual > Evolutionary Algorithms > Modeling and Solving a Basic EA Problem > Writing a simple generation loop > Suggested Answers

Exercise 1

Change the parameter "2" in IloTournamentSelector to "5" for example:

  IloPoolProc selector = IloTournamentSelector(
    env, 5, IloBestSolutionComparator(env), IloTrue 
  );

You should see that the optimal is found within the default generation limit this time, whereas it was not before.

Exercise 2

Change the generation of the solution operator to:

  IloPoolProc applyOp = factory.uniformXover(0.5, "uXover");

The 0.5 indicates that features of the child should probably be equally drawn from both parents of the crossover. With this operator, the optimum is found more quickly than when using mutation.