12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The heart of the example is here, in the column generation and optimization over currentpatterns:IloNumArray price(env, nWdth);IloNumArray newPatt(env, nWdth);for (;;) {/// OPTIMIZE OVER CURRENT PATTERNS ///cutSolver.solve();report1 (cutSolver, Cut, Fill);/// FIND AND ADD A NEW PATTERN ///for (i = 0; i < nWdth; i++)price[i] = -cutSolver.getDual(Fill[i]);ReducedCost.setLinearCoefs(Use, price);patSolver.solve();report2 (patSolver, Use, ReducedCost);if (patSolver.getValue(ReducedCost) > -RC_EPS) break;patSolver.getValues(newPatt, Use);Cut.add( IloNumVar(RollsUsed(1) + Fill(newPatt)) );}cutOpt.add(IloConversion(env, Cut, ILOINT));cutSolver.solve();Those lines solve the current subproblem cutOpt by calling cutSolver.solve. Then theycopy the values of the negative dual solution into the array price. They use that array to setobjective coefficients in the model patGen. Then they solve the right pattern generationproblem.If the objective value of the subproblem is nonnegative within the tolerance RC_EPS, thenthe application has proved that the current solution of the model cutOpt is optimal withinthe given optimality tolerance (RC_EPS). Otherwise, the application copies the solution ofthe current pattern generation problem into the array newPatt and uses that new pattern tobuild the next column to add to the model cutOpt. Then it repeats the procedure.Ending the ProgramAs in other C++ Concert Technology applications, this program ends with a call toIloEnv::end to de-allocate the models and algorithms once they are no longer in use.env.end();<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 381

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!