ILOG CPLEX supports two views of quadratic objective functions, a matrix view and an algebraic view.
In the algebraic view, a quadratic objective function is specified as an expressions of the form:
ILOG CPLEX LP format requires the factor of ½ to be explicitly specified in the file.
Minimize obj: [ 100 x1 ^2 - 200 x1 * x2 + 100 x2 ^2 ] / 2 |
MPS
format for this same objective function would contain the following.
QMATRIX x1 x1 100 x1 x2 -100 x2 x1 -100 x2 x2 100 |
A C++ Concert program having such an objective function might include the following.
A similar Java program using Concert might express it this way: