-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample1.gms
78 lines (65 loc) · 2.56 KB
/
example1.gms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
* example1.gms
* This file contains the GAMS scalar format description of the problem
*
* minimize objvar = -2*x1 +3*x2 -2*x3
* subject to
* x1^2 + 3*x2^2 -2*x2*x3 +3*x3^2 -17*x1 +8*x2 -14*x3 >= -19,
* x1 + 2*x2 + x3 <= 5,
* 5*x2 + 2*x3 = 7
* 0 <= x1 <= 2, 0 <= x2 <= 1.
*
* To solve this problem by sparsePOP.m:
* >> param.relaxOrder = 3;
* >> sparsePOP('example1.gms',param);
*
* This problem is also described in terms of the SparsePOP format
* in the file example1.m. See Section 3 of the manual.
*
* To obtain a tight bound for the optimal objective value by the function
* sparsePOP.m, set the parameter param.relaxOrder = 3.
* The description consists of 5 parts except comment lines
* starting the character '*'. The 5 parts are:
* < List of the names of variables >
* < List of the names of nonnegative variables >
* < List of the names of constraints >
* < The description of constraints >
* < Lower and upper bounds of variables >
* < List of the names of variables >
Variables x1,x2,x3,objvar;
* 'objvar' represents the value of the objective function.
* < List of the names of nonnegative variables >
Positive Variables x1, x2;
* < List of the names of constraints >
Equations e1,e2,e3,e4;
* < The description of constraints >
* Each line should start with the name of a constraint in the list of names
* of constraints, followed by '.. '. The symbols '*', '+', '-', '^', '=G='
* (not less than), '=E=' (equal to) and '=L=' (not larger than) can be used
* in addition to the variables in the list of the names of variables and real
* numbers. The right-hand side of an inequality or an equality should be a
* single constant. One constraint can be described in more than one lines;
* for example,
* e2.. - 17*x1 + 8*x2 - 14*x3 +6*x1^2 + 3*x2^2 - 2*x2*x3 + 3*x3^2 =G= -19;
* is equivalent to
* e2.. - 17*x1 + 8*x2 - 14*x3 +6*x1^2
* + 3*x2^2 - 2*x2*x3 + 3*x3^2 =G= -19;
* Note that the first letter of a line can not be '*' except comment lines.
* minimize objvar = -2*x1 +3*x2 -2*x3
e1.. 2*x1 - 3*x2 + 2*x3 + objvar =E= 0;
* 6*x1^2 + 3*x2^2 -2*x2*x3 +3*x3^2 -17*x1 +8*x2 -14*x3 >= -19
e2.. - 17*x1 + 8*x2 - 14*x3 +6*x1^2 + 3*x2^2 - 2*x2*x3 + 3*x3^2 =G= -19;
* x1 + 2*x2 + x3 <= 5
e3.. x1 + 2*x2 + x3 =L= 5;
* 5*x2 + 2*x3 = 7
e4.. 5*x2 + 2*x3 =E= 7;
* < Lower and upper bounds on variables >
* Each line should contain exactly one bound;
* For 0.5 <= x3 <= 2, we set
* x3.lo = 0.5;
* x3.up = 2;
* A line such that 'x3.lo = 0.5; x3.up = 2;' is not allowed.
* x1 <= 2
x1.up = 2;
* x2 <= 1
x2.up = 1;
* end of example1.gms