-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenerateMinDegenerateSet_MIP2.gms
95 lines (67 loc) · 1.75 KB
/
GenerateMinDegenerateSet_MIP2.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
************************************************************
***** MILP for Irreducible Set of Degenerate Equations *****
************************************************************
* Created by Alex Dowling at Carnegie Mellon University
* awdowlin@andrew.cmu.edu
* Last Modified: June 10th, 2014
$onempty
$set matout "'degenSol.gdx', x, y, Z, MIPstat ";
Sets
i Equations /e1*e100000/
j Variables /x1*x100000/
actE(i) Equations in active Jacobian
SE(i) Suspect equation
;
* Note: Increasing the number of equations and variables declared in GAMS (above) increases run time.
* Currently 100,000 variables and equations are supported. To increase this number, simply increase the
* size of i & j.
Parameter
A(i,j) Jacobian
MIPstat
;
$gdxin jacobian.gdx
$load A
$gdxin
$gdxin degenData.gdx
$load actE
$load SE
$gdxin
display actE, SE;
*stop
Scalar
bigM Big-M constant /10/
;
Variable
x(i) Eigenvector
z Objective function value;
Binary Variable
y(i) Vector element toggle;
Equations
EqDegenecary(j)
xlow(i)
xup(i)
EqObj ;
EqDegenecary(j)..
SUM(i$actE(i), A(i,j)*x(i)) =e= 0;
xlow(i)$actE(i)..
-bigM*y(i) =l= x(i);
xup(i)$actE(i)..
x(i) =l= bigM*y(i);
EqObj..
z =e= SUM(i$actE(i), y(i));
Model GenerateMinDegenerateSet /All/;
*option MINLP = SBB;
*option NLP = SNOPT;
*option MINLP = DICOPT;
*option MIP = GUROBI;
option MIP = CPLEX;
GenerateMinDegenerateSet.optca = 0.9;
GenerateMinDegenerateSet.optcr = 0.01;
x.l(i) = 1;
y.l(i) = 1;
y.fx(SE) = 1;
x.fx(SE) = 1;
*GenerateMinDegenerateSet.optfile = 1;
Solve GenerateMinDegenerateSet minimizing Z using MIP;
MIPstat = GenerateMinDegenerateSet.modelStat;
execute_unload %matout%;