IBM ILOG Solver User's Manual > Local Search > Minimizing Talent Wait Cost Using LNS > Problem solving: Finding an initial solution

Now you create an initial solution to the problem which will serve as a starting point for the LNS which will follow. Before you do this, you need to create an instance of IloSolver which will be used for search.

Step 4   -  

Create a solver

Insert the following code after the comment
// Create the solver, and seed its random number generator

      IloSolver solver(model);
      solver.getRandom().reSeed(seed);

This code creates the solver from the model and afterwards sets this solver's random number seed to that specified on the command line. In this way, different seeds can be specified to observe different search trajectories.

You can now create the initial solution.

Step 5   -  

Generate an initial solution

Insert the following code after the comment
// Create an initial solution to the problem

      IloGoal goal = IloGenerate(env, scene);
      solver.solve(goal);

Here, you use the basic IloGenerate goal on the scene variables to produce the initial solution.

To perform any local search using Solver IIM, you need to have an instance of an IloSolution object which represents the current solution. You will now create this solution object.

Step 6   -  

Create the solution object

Insert the following code after the comment // Create the solution object

      IloSolution solution(env);
      solution.add(scene);
      IloObjective objective = IloMinimize(env, idleCost);
      solution.add(objective);
      solution.store(solver);

Here you add the decision variables scene to the solution object, as well as the objective which is to minimize total idle time. Addition of the objective allows improvement search to compare the current solution with the new proposed solution. Finally, you store the current values of the decision variables in the solution via solution.store(solver).