01: // --------------------------------------------------------------------------
02: // Licensed Materials - Property of IBM
03: //
04: // 5725-A06 5725-A29 5724-Y48 5724-Y49 5724-Y54 5724-Y55
05: // Copyright IBM Corporation 1998, 2013. All Rights Reserved.
06: //
07: // Note to U.S. Government Users Restricted Rights:
08: // Use, duplication or disclosure restricted by GSA ADP Schedule
09: // Contract with IBM Corp.
10: // --------------------------------------------------------------------------
11: 
12: /* QCP: Quadratic Constraint
13:  *
14:  * Example from CPLEX : iloqcpex1.cpp 
15:  */
16: range R = 0..2;
17: dvar float x[R] in 0..40;
18: 
19: 
20: maximize
21:   x[0] + 2 * x[1] + 3 * x[2]
22:   - 0.5 * ( 33 * x[0]^2 + 22 * x[1]^2 + 11 * x[2]^2 
23:           - 12 * x[0] * x[1] - 23 *x [1] * x[2] );
24: 
25: subject to {
26:   ct1:  - x[0] +     x[1] + x[2] <= 20;
27:   ct2:    x[0] - 3 * x[1] + x[2] <= 30;
28:   ct3:    x[0]^2 + x[1]^2 + x[2]^2 <= 1.0;
29: }
30: 
31: tuple xSolutionT{ 
32:         int R; 
33:         float value; 
34: };
35: {xSolutionT} xSolution = {<i0,x[i0]> | i0 in R};
36: execute{ 
37:         writeln(xSolution);
38: }
39: