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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

optimizers are primal-dual in nature, and one result of that is the scaling of the objectivefunction interacts directly with the scaling of the constraints.Just as our recommendation regarding numeric difficulties on LP models (see NumericDifficulties on page 185) is for coefficients in the constraint matrix not to vary by more thanabout six orders of magnitude, for QP this recommendation expands to include the quadraticelements of the objective function coefficients as well. Fortunately, in most instances it isstraightforward to scale your objective function, by multiplying or dividing all thecoefficients (linear and quadratic) by a constant factor, which changes the unit ofmeasurement for the objective but does not alter the meaning of the variables or the sense ofthe problem as a whole. If your objective function itself contains a wide variation ofcoefficient magnitudes, you may also want to consider scaling the individual columns toachieve a closer range.Examples: Creating a QP, Optimizing, Finding a SolutionThis example shows you how to build and solve a QP. The problem being created and solvedis:Maximizex 1 + 2x 2 + 3x 3 - 0.52(33x 1+ 22x 22+ 11x 32- 12x 1 x 2 - 23x 2 x 3 )subject to-x 1 + x 2 + x 3 ≤ 20x 1 - 3x 2 + x 3 ≤ 30with these bounds0 ≤ x 1 ≤ 400 ≤ x 2 ≤ +∞0 ≤ x 3 ≤ +∞The following sections solve this model in the various APIs available in <strong>ILOG</strong> <strong>CPLEX</strong>:◆ Example: iloqpex1.cpp on page 236◆ Example: QPex1.java on page 237◆ Example: qpex1.c on page 237Example: iloqpex1.cppThis example is almost identical to ilolpex1.cpp with only function populatebyrow tocreate the model. Also, this function differs only in the creation of the objective from its236 <strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL

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

Saved successfully!

Ooh no, something went wrong!