source: trunk/sample/optimization/sample_optimize2.mso @ 996

Last change on this file since 996 was 990, checked in by Argimiro Resende Secchi, 7 years ago
File size: 6.0 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* More test problems
17*--------------------------------------------------------------------
18* Author: Argimiro R Secchi               
19* $Id$
20*--------------------------------------------------------------------*#
21Optimization test27  # solution: x1=0.7411, x2=0.7411, obj=-17.96
22        PARAMETERS
23        pi as Real;
24
25        VARIABLES
26        x1 as Real(Default=0,Lower=-1,Upper=1);
27        x2 as Real(Default=0,Lower=-1,Upper=1);
28
29        SET
30        pi = 4*atan(1)/'rad';
31
32        MINIMIZE
33        -(abs(20*x1)+abs(20*x2)+2*(x1+x2)) * sin(20*'rad'*x1/pi)^2 *
34        sin(20*'rad'*x2/pi)^2 + 40*(x1^2+x2^2)/3;
35
36        OPTIONS
37        NLPSolver(MaxIterations=2000,
38                          AbsoluteAccuracy=1e-6,
39                          RelativeAccuracy=1e-4,
40                          #File = "ipopt_emso", hessian_approximation = "exact"
41                          #File = "complex"
42                  #File = "optpp_emso"
43                          #File = "arshj"
44                          #File = "PSO"
45                          File = "direct", MinimumRectangle=1e-4,MaxEvals=5000
46                          );
47        Dynamic = false;
48end
49
50# Alpina function
51Optimization test28  # solution: x1=7.917, x2=7.917, obj=-7.8856
52        VARIABLES
53        x1 as Real(Default=3,Lower=0,Upper=10);
54        x2 as Real(Default=1,Lower=0,Upper=10);
55
56        MINIMIZE
57        -sqrt(x1*x2)*sin(x1*'rad')*sin(x2*'rad');
58
59        OPTIONS
60        NLPSolver(MaxIterations=2000,
61                          AbsoluteAccuracy=1e-6,
62                          RelativeAccuracy=1e-4,
63                          #File = "ipopt_emso", hessian_approximation = "exact"
64                          #File = "complex"
65                  #File = "optpp_emso"
66                          #File = "arshj"
67                          #File = "PSO"                   
68                          File = "direct", MinimumRectangle=1e-4,MaxEvals=5000
69                          );
70        Dynamic = false;
71end
72
73# Griewank function
74Optimization test29  # solution: x1=0, x2=0, obj=0
75        VARIABLES
76#       x1 as Real(Default=0,Lower=-100,Upper=100);
77#       x2 as Real(Default=9,Lower=-100,Upper=100);
78        x1 as Real(Default=0,Lower=-100,Upper=90);
79        x2 as Real(Default=9,Lower=-100,Upper=90);
80
81        MINIMIZE
82        1+(x1^2+x2^2)/4000-cos(x1*'rad')*cos(x2*'rad'/sqrt(2));
83
84        OPTIONS
85        NLPSolver(MaxIterations=4000,
86                          AbsoluteAccuracy=1e-6,
87                          RelativeAccuracy=1e-4,
88                          #File = "ipopt_emso", hessian_approximation = "exact"
89                          #File = "complex"
90                  #File = "optpp_emso"
91                          #File = "arshj"
92                          #File = "PSO"                   
93                          #File = "direct", MinimumRectangle=1e-4,MaxEvals=5000
94                          File = "direct", MinimumRectangle=1e-10,Epsilon=1e-2,MaxEvals=10000   
95                          );
96        Dynamic = false;
97end
98
99Optimization test31  # solution: x=8.817, obj=-8.13
100        VARIABLES
101        x as Real(Default=-10,Lower=-10,Upper=10);
102
103        MINIMIZE
104        (x+10)*(x+6)*(x+5)*(x+1)*(x-7)*(x-10)*1e-4;
105
106        OPTIONS
107        NLPSolver(MaxIterations=2000,
108                          AbsoluteAccuracy=1e-6,
109                          RelativeAccuracy=1e-4,
110                          #File = "ipopt_emso", hessian_approximation = "exact"
111                          #File = "complex"
112                  #File = "optpp_emso"
113                          #File = "arshj"
114                          #File = "PSO"                   
115                          File = "direct", MinimumRectangle=1e-4,MaxEvals=5000
116                          );
117        Dynamic = false;
118end
119
120# Levy 5 function
121Optimization test32  # solution: x1=-1.3068, x2=-1.4248, obj=-176.1376
122        PARAMETERS
123        i(5) as Integer;
124
125        VARIABLES
126        x1 as Real(Default=0,Lower=-10,Upper=10);
127        x2 as Real(Default=0,Lower=-10,Upper=10);
128
129        SET
130        i = [1:5];
131
132        MINIMIZE
133        sum(i*cos(((i-1)*x1+i)*'rad'))*sum(i*cos(((i+1)*x2+i)*'rad'))+(x1+1.42513)^2+(x2+0.80032)^2;
134
135        OPTIONS
136        NLPSolver(MaxIterations=2000,
137                          AbsoluteAccuracy=1e-6,
138                          RelativeAccuracy=1e-4,
139                          #File = "ipopt_emso", hessian_approximation = "exact"
140                          #File = "complex"
141                  #File = "optpp_emso"
142                          #File = "arshj"
143                          #File = "PSO"                   
144                          File = "direct", MinimumRectangle=1e-5,Epsilon=1e-1,MaxEvals=10000
145                          );
146        Dynamic = false;
147end
148
149# H1 function
150Optimization test33  # solution: x1=8.6998, x2=6.7665, obj=-2
151        VARIABLES
152        x1 as Real(Default=0,Lower=-100,Upper=100);
153        x2 as Real(Default=0,Lower=-100,Upper=100);
154
155        MINIMIZE
156        -(sin((x1-x2/8)*'rad')^2+sin((x2+x1/8)*'rad')^2)/(1+sqrt((x1-8.6998)^2+(x2-6.7665)^2));
157
158        OPTIONS
159        NLPSolver(MaxIterations=2000,
160                          AbsoluteAccuracy=1e-6,
161                          RelativeAccuracy=1e-4,
162                          #File = "ipopt_emso", hessian_approximation = "exact"
163                          #File = "complex"
164                  #File = "optpp_emso"
165                          #File = "arshj"
166                          #File = "PSO"                   
167                          File = "direct", MinimumRectangle=1e-4,Epsilon=1e-1,MaxEvals=10000
168                          );
169        Dynamic = false;
170end
171
172# Ackley function
173Optimization test34  # solution: x=0, obj=0
174        PARAMETERS
175        n as Integer(Default=3);
176        pi as Real;
177
178        VARIABLES
179        x(n) as Real(Default=10,Lower=-32.68,Upper=32.68/2);
180#       x(n) as Real(Default=10,Lower=-32.68,Upper=32.68);
181
182        SET
183        pi = 4*atan(1)/'rad';
184
185        MINIMIZE
186        -20*exp(-0.2*sqrt(sum(x^2)/n))-exp(sum(cos(2*pi*x*'rad'))/n)+20+exp(1);
187
188        OPTIONS
189        NLPSolver(MaxIterations=2000,
190                          AbsoluteAccuracy=1e-6,
191                          RelativeAccuracy=1e-4,
192                          #File = "ipopt_emso", hessian_approximation = "exact"
193                          #File = "complex"
194                  #File = "optpp_emso"
195                          #File = "arshj"
196                          #File = "PSO"                   
197                          File = "direct", MinimumRectangle=1e-8,Epsilon=1e-1,MaxEvals=20000
198                          );
199        Dynamic = false;
200end
201
202# Schwefel function
203Optimization test35  # solution: x=420.9687, obj=-n (approx.)
204        PARAMETERS
205        n as Integer(Default=4);
206
207        VARIABLES
208        x(n) as Real(Default=0,Lower=-500,Upper=500);
209
210        MINIMIZE
211        418*n-sum(x*sin(sqrt(abs(x))*'rad'));
212
213        OPTIONS
214        NLPSolver(MaxIterations=2000,
215                          AbsoluteAccuracy=1e-6,
216                          RelativeAccuracy=1e-4,
217                          #File = "ipopt_emso", hessian_approximation = "exact"
218                          #File = "complex"
219                  #File = "optpp_emso"
220                          #File = "arshj"
221                          #File = "PSO"                   
222                          File = "direct", MinimumRectangle=1e-8,Epsilon=1e-3,MaxEvals=30000
223                          );
224        Dynamic = false;
225end
Note: See TracBrowser for help on using the repository browser.