ILOG CPLEX 11.0 User's Manual > Continuous Optimization > Solving Problems with a Quadratic Objective (QP) > Examples: Creating a QP, Optimizing, Finding a Solution > Example: iloqpex1.cpp |
Example: iloqpex1.cpp |
INDEX PREVIOUS NEXT |
This example is almost identical to ilolpex1.cpp
with only function populatebyrow
to create the model. Also, this function differs only in the creation of the objective from its ilolpex1.cpp
counterpart. Here the objective function is created and added to the model like this:
In general, any expression built of basic operations +
, -
, *
, /
constant, and brackets [] that amounts to a quadratic and optional linear term can be used for building QP objective function. Note that, if the expressions of the objective or any constraint of the model contains IloPiecewiseLinear
, then when a quadratic objective is specified the model becomes an MIQP problem. (Piecewise-linearity is not the only characteristic that renders a model MIQP. See also, for example, the features in Logical Constraints in Optimization, where automatic transformation with logical constraints can render a problem MIQP.)
The complete program iloqpex1.cpp
appears online in the standard distribution at yourCPLEXinstallation/examples/src
.
Copyright © 1987-2007 ILOG S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |