Optimization AMPL IPOPT给出错误的最优解,而求解结果为;“已解决”;
我试图用IPOPT在AMPL中解决一个非常简单的优化问题,如下所示:Optimization AMPL IPOPT给出错误的最优解,而求解结果为;“已解决”;,optimization,ampl,ipopt,Optimization,Ampl,Ipopt,我试图用IPOPT在AMPL中解决一个非常简单的优化问题,如下所示: var x1 >= 0 ; minimize obj: -(x1^2)+x1; 显然,这个问题是无限的。但IPOPT给了我: ****************************************************************************** This program contains Ipopt, a library for large-scale nonlinear opti
var x1 >= 0 ;
minimize obj: -(x1^2)+x1;
显然,这个问题是无限的。但IPOPT给了我:
******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************
This is Ipopt version 3.12.4, running with linear solver mumps.
NOTE: Other linear solvers might be more efficient (see Ipopt documentation).
Number of nonzeros in equality constraint Jacobian...: 0
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian.............: 1
Total number of variables............................: 1
variables with only lower bounds: 1
variables with lower and upper bounds: 0
variables with only upper bounds: 0
Total number of equality constraints.................: 0
Total number of inequality constraints...............: 0
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 0
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
0 9.8999902e-03 0.00e+00 2.00e-02 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0
1 1.5346023e-04 0.00e+00 1.50e-09 -3.8 9.85e-03 - 1.00e+00 1.00e+00f 1
2 1.7888952e-06 0.00e+00 1.84e-11 -5.7 1.52e-04 - 1.00e+00 1.00e+00f 1
3 -7.5005506e-09 0.00e+00 2.51e-14 -8.6 1.80e-06 - 1.00e+00 1.00e+00f 1
Number of Iterations....: 3
(scaled) (unscaled)
Objective...............: -7.5005505996934397e-09 -7.5005505996934397e-09
Dual infeasibility......: 2.5091040356528538e-14 2.5091040356528538e-14
Constraint violation....: 0.0000000000000000e+00 0.0000000000000000e+00
Complementarity.........: 2.4994494940593761e-09 2.4994494940593761e-09
Overall NLP error.......: 2.4994494940593761e-09 2.4994494940593761e-09
Number of objective function evaluations = 4
Number of objective gradient evaluations = 4
Number of equality constraint evaluations = 0
Number of inequality constraint evaluations = 0
Number of equality constraint Jacobian evaluations = 0
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations = 3
Total CPU secs in IPOPT (w/o function evaluations) = 0.001
Total CPU secs in NLP function evaluations = 0.000
EXIT: Optimal Solution Found.
Ipopt 3.12.4: Optimal Solution Found
suffix ipopt_zU_out OUT;
suffix ipopt_zL_out OUT;
ampl: display x1;
x1 = 0
当我将解算器更改为Gurobi时,它会给出以下消息:
Gurobi 6.5.0: unbounded; variable.unbdd returned.
这正是我所期望的。
我不明白为什么会发生这种情况,现在我不知道是否需要检查我试图解决的所有问题,以避免收敛到错误的最优解。因为这是一个超级简单的例子,所以有点奇怪
如果有人能帮我,我将不胜感激
谢谢我想我明白为什么会这样。目标函数
-(x1^2)+x1;
它不是凸的。因此,给定的解决方案是局部最优的。您已经确定了基本问题,但详细说明了这两个解算器产生不同结果的原因: IPOPT设计用于涵盖广泛的优化问题,因此它使用一些相当通用的数值优化方法。我不熟悉IPOPT的细节,但通常这种方法依赖于选择一个起点,查看目标函数在该起点附近的曲率,然后沿着曲率“下坡”,直到找到局部最优。不同的起点可能导致不同的结果。在这种情况下,IPOPT的起始点可能默认为零,因此它正好位于局部最小值之上。正如Erwin所建议的,如果指定不同的起点,它可能会发现无界性
Gurobi是专门为二次/线性问题设计的,因此它使用了非常不同的方法,这些方法不易受到局部极小值问题的影响,并且对于二次问题,它可能会更加有效。但是它不支持更一般的目标函数。0是一个不好的起点。使用例如
var x1>=0:=1代码>。