source: trunk/sample/optimization/sample_minlp.mso @ 957

Last change on this file since 957 was 552, checked in by Argimiro Resende Secchi, 14 years ago

Adding optimization examples.

File size: 5.6 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*--------------------------------------------------------------------
16* Some MINLP test problems
17*--------------------------------------------------------------------
18* Author: Edson Cordeiro do Valle, Rafael de Pelegrini Soares             
19* $Id$
20*--------------------------------------------------------------------*#
21
22Optimization minlp1
23        VARIABLES
24        x0 as Integer(Default=0, Lower=0, Upper=1);
25        x1 as Real(Default=0, Lower=0, Upper=1.0e10);
26        x2 as Real(Default=0, Lower=0, Upper=1.0e10);
27        x3 as Integer(Default=0, Lower=0, Upper=5);
28       
29
30        MINIMIZE
31        -1*(x0 + x1 + x2);
32       
33        EQUATIONS
34       
35        (x1 - 0.5)^2 + (x2 - 0.5)^2 <= 0.25;
36        x0 - x1 <= 0;
37        x0 + x2 + x3 <= 2;
38       
39        OPTIONS
40        Dynamic = false;
41        NLPSolveNLA = true;
42       
43        NLPSolver(File = "minlp_emso", derivative_test = "second-order",
44        print_level = 5);
45
46end
47
48Optimization minlp2
49        VARIABLES
50        x as Real(Default=0, Lower=0.2, Upper=1);
51        y1 as Integer(Default=1, Lower=0, Upper=1);
52        y2 as Integer(Default=1, Lower=0, Upper=1);
53        y3 as Integer(Default=0, Lower=0, Upper=1);
54       
55
56        MINIMIZE
57        y1 + y2 + y3 + 5*x^2;
58       
59        EQUATIONS
60        3*x -y1 -y2 <= 0;
61        -x + 0.1*y2 + 0.25* y3 <= 0;
62        y1 + y2 + y3 >= 2;
63        y1 + y2 + 2*(y3 - 1) >=0;
64       
65        OPTIONS
66        Dynamic = false;
67        NLPSolveNLA = true;
68       
69        NLPSolver(File = "minlp_emso", derivative_test = "second-order",
70        print_level = 5);
71
72end
73
74Optimization minlp3
75        VARIABLES
76        x1 as Real(Default=0, Lower=0, Upper=1e10);
77        x2 as Real(Default=0, Lower=0, Upper=1e10);
78        x3 as Real(Default=1, Lower=0, Upper=1e10);
79        y1 as Integer(Default=0, Lower=0, Upper=1);
80        y2 as Integer(Default=1, Lower=0, Upper=1);
81        y3 as Integer(Default=0, Lower=0, Upper=1);
82       
83
84        MINIMIZE
85        -2.9*x3 -8.9*ln(1+x1) - 10.44*ln(1+x2) + 1.8*x1 +
86        1.8*x2 + 3.5*y1 + y2 + 1.5*y3;
87       
88        EQUATIONS
89       
90        -y1 + 0.9*ln(1+x1) + 1.08*ln(1+x2) +0.9*x3 <=0;
91        -10*y2 + ln(1+ x1) <=0;
92        -10*y3 + 1.2*ln(1+x2) <=0;
93        y2 + y3 -1 <=0;
94       
95        OPTIONS
96        Dynamic = false;
97        NLPSolveNLA = true;
98       
99        NLPSolver(File = "minlp_emso", derivative_test = "second-order",
100        bonmin_algorithm = "B-BB",  print_level = 5);
101
102end
103FlowSheet minlp_flow
104VARIABLES
105
106        p1a as Real(Default=10, Lower=0, Upper=50);
107        p1b as Real(Default=10, Lower=0, Upper=50);
108        p2a as Real(Default=10, Lower=0, Upper=50);
109        p2b as Real(Default=10, Lower=0, Upper=50);
110    f1  as Real(Default=10, Lower=0, Upper=25);
111        f2  as Real(Default=10, Lower=0, Upper=25);
112        f3a as Real(Default=10, Lower=0, Upper=50);
113        f3b as Real(Default=10, Lower=0, Upper=50);
114        f4a as Real(Default=10, Lower=0, Upper=50);
115        f4b as Real(Default=10, Lower=0, Upper=50);
116        f5a as Real(Default=10, Lower=0, Upper=50);
117        f5b as Real(Default=10, Lower=0, Upper=50);
118        f6a as Real(Default=10, Lower=0, Upper=50);
119        f6b as Real(Default=10, Lower=0, Upper=50);
120        f7a as Real(Default=10, Lower=0, Upper=50);
121        f7b as Real(Default=10, Lower=0, Upper=50);
122        f8a as Real(Default=10, Lower=0, Upper=50);
123        f8b as Real(Default=10, Lower=0, Upper=50);
124        f9a as Real(Default=10, Lower=0, Upper=50);
125        f9b as Real(Default=10, Lower=0, Upper=50);
126        f10a as Real(Default=10, Lower=0, Upper=50);
127        f10b as Real(Default=10, Lower=0, Upper=50);
128        f11a as Real(Default=10, Lower=0, Upper=50);
129        f11b as Real(Default=10, Lower=0, Upper=50);
130        e4 as Real(Default=10, Lower=0, Upper=1);
131        e5 as Real(Default=10, Lower=0, Upper=1);
132        e6 as Real(Default=10, Lower=0, Upper=1);
133       
134#       yd as Integer(Default=1, Lower=0, Upper=1);
135#       yf as Integer(Default=0, Lower=0, Upper=1);
136
137        EQUATIONS
138
139        f3a = 0.55*f1 + 0.50*f2; #mixer11:
140        f3b = 0.45*f1 + 0.50*f2; #mixer12:
141        f4a = e4*f3a; #splitter1
142        f4b = e4*f3b; #splitter2
143        f5a = e5*f3a; #splitter3
144        f5b = e5*f3b; #splitter4
145        f6a = e6*f3a; #splitter5
146        f6b = e6*f3b; #splitter6
147        f7a = f3a - f4a - f5a - f6a; #splitter7
148        f7b = f3b - f4b - f5b - f6b; #splitter8
149        f8a = 0.85*f4a; #flash1
150        f8b = 0.20*f4b; #flash2
151        f9a = 0.15*f4a; #flash3
152        f9b = 0.80*f4b; #flash4
153        f10a = 0.975*f5a; #distil1
154        f10b = 0.050*f5b; #distil2
155        f11a = 0.025*f5a; # distil3
156        f11b = 0.950*f5b; # distil4
157        p1a = f8a + f10a + f6a; # mixer21
158        p1b = f8b + f10b + f6b; # mixer22
159        p2a = f9a + f11a + f7a; # mixer31
160        p2b = f9b + f11b + f7b; # mixer32
161
162SPECIFY
163        f3a = 1;
164        f4a = 1;
165        f5a = 1;
166        f6a = 1;
167        f8b = 1;
168
169OPTIONS
170        Dynamic = false;
171        NLASolver(
172                RelativeAccuracy = 1e-5
173        );
174
175end
176
177Optimization opt_minlp_flow as minlp_flow
178VARIABLES
179        yd as Integer(Default=1, Lower=0, Upper=1);
180        yf as Integer(Default=0, Lower=0, Upper=1);
181
182MINIMIZE
183-35*p1a - 30*p2b + 10*f1 + 8*f2 + f4a + f4b + 4*f5a
184       + 4*f5b + 2*yf + 50*yd;
185       
186EQUATIONS
187
188  f4a + f4b >= 2.5*yf; #logical1
189  f4a + f4b <= 25*yf;#logical2
190  f5a + f5b >= 2.5*yd;#logical3
191  f5a + f5b <= 25*yd;#logical4
192  p1a >= 4*p1b;#spec1
193  p2b >= 3*p2a;#spec2
194  p1a + p1b <= 15;#spec3
195  p2a + p2b <= 18;#spec4
196
197FREE
198        f3a;
199        f4a;
200        f5a;
201        f6a;
202        f8b;
203
204OPTIONS
205        Dynamic = false;
206        NLPSolveNLA = false;
207        NLPSolver(#File = "complex",
208                          #File = "optpp_emso",
209                          File = "minlp_emso",
210                          bonmin_algorithm = "B-BB",
211                          bonmin_bb_log_level = 2,
212                          #Hessian_approximation = "exact",
213                          MaxIterations = 10000,
214                          RelativeAccuracy = 1e-6);
215
216end
Note: See TracBrowser for help on using the repository browser.