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