问题: 求三元函数 f(x1,x2,x3)=(x1^x2+x2^x1-5*x1*x2*x3-85)^2+(x1^3*x2^x3*x3^x2-60)^2+(x1^x3+x3^x1-x2-0.55)^2, x1>0,x2>0, x3>0的最小值. 该函数参考自: http://www.chinavib.com/forum/thread-61983-1-1.html
LINGO代码(设置Multistart solver的尝试次数为2):
min=(x1^x2+x2^x1-5*x1*x2*x3-85)^2+(x1^3*x2^x3*x3^x2-60)^2+(x1^x3+x3^x1-x2-0.55)^2;
x1>=0.000001;
x2>=0.000001;
x3>=0.000001;
输入结果:
Local optimal solution found.
Objective value: 0.6463502E-01
Infeasibilities: 0.000000
Extended solver steps: 2
Total solver iterations: 129
Variable Value Reduced Cost
X1 4.834151 0.1759665E-08
X2 2.439950 0.2930940E-08
X3 0.6160029 0.3068479E-08
Row Slack or Surplus Dual Price
1 0.6463502E-01 -1.000000
2 4.834150 0.000000
3 2.439949 0.000000
4 0.6160019 0.000000
AMPL代码:
param e =0.000001;
param N:=5;
param zv{1..N};
var x1>=e;
var x2>=e;
var x3>=e;
minimize obj:(x1^x2+x2^x1-5*x1*x2*x3-85)^2+
(x1^3*x2^x3*x3^x2-60)^2+(x1^x3+x3^x1-x2-0.55)^2;
option solver snopt;
for{i in 1..N}
{
let x1:=Uniform(e,3);
let x2:=Uniform(e,3);
let x3:=Uniform(e,3);
solve;
let zv[i]:=obj;
display x1,x2,x3,obj;
}
display zv;
输入结果:
SNOPT 7.2-8 : Optimal solution found.
26 iterations, objective 10489.20709
Nonlin evals: obj = 25, grad = 24.
x1 = 1e-06
x2 = 1e-06
x3 = 1.07167
obj = 10489.2
SNOPT 7.2-8 : The current point cannot be improved.
1231 iterations, objective 0.1862818569
Nonlin evals: obj = 872, grad = 871.
x1 = 154.347
x2 = 0.88162
x3 = 3.71388e-06
obj = 0.186282
SNOPT 7.2-8 : Optimal solution found.
490 iterations, objective 0.06463501796
Nonlin evals: obj = 357, grad = 356.
x1 = 4.83415
x2 = 2.43995
x3 = 0.616003
obj = 0.064635
SNOPT 7.2-8 : The current point cannot be improved.
1247 iterations, objective 0.1860335176
Nonlin evals: obj = 870, grad = 869.
x1 = 154.605
x2 = 0.881325
x3 = 3.67748e-06
obj = 0.186034
SNOPT 7.2-8 : Optimal solution found.
169 iterations, objective 0.06463501796
Nonlin evals: obj = 124, grad = 123.
x1 = 4.83415
x2 = 2.43995
x3 = 0.616003
obj = 0.064635
zv [*] :=
1 10489.2
2 0.186282
3 0.064635
4 0.186034
5
;
由输出结果可以看出最小值为0.064635, 在这里采用多个开始点还是很必要的, 此举导致的计算时间完全可接受.