> Discrete Optimization > Cutting Stock: Column Generation > Solving the Problem: Using More than One Algorithm |
Solving the Problem: Using More than One Algorithm |
INDEX PREVIOUS NEXT |
This example does not solve the problem to optimality. It only generates a good feasible solution. It does so by first solving a linear relaxation of the problem. In other words, the decision variables Cut[j]
are relaxed (not required to be integers). This linear relaxation of the problem then generates columns. While generating columns, the application keeps the variables generated so far, changes their type to integer, and resolves the problem.
As you've seen, this example effectively builds two models of the problem, cutOpt
and patGen
. Likewise, it uses two algorithms (that is, two instances of IloCplex
) to arrive at a good feasible solution.
Here's how to create the first algorithm cutSolver
and extract the initial model cutOpt
:
IloCplex cutSolver(cutOpt); |
And here is how to create the second algorithm and extract patGen
:
IloCplex patSolver(patGen); |
The heart of the example is here, in the column generation and optimization over current patterns:
Those lines solve the current subproblem cutOpt
by calling cutSolver.solve
. Then they copy the values of the negative dual solution into the array price
. They use that array to set objective coefficients in the model patGen
. Then they solve the right pattern generation problem.
If the objective value exceeds the negation of the optimality tolerance (-RC_EPS
), then the application has proved that the current solution of the model cutOpt
is optimal within the given optimality tolerance (RC_EPS
). Otherwise, the application copies the solution of the current pattern generation problem into the array newPatt
and uses that new pattern to build the next column to add to the model cutOpt
. Then it repeats the procedure.
Copyright © 1987-2003 ILOG, S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |