AMPL IPOPT提供了错误的最优解决方案,而解决结果已经解决了#34;

时间:2018-04-12 02:47:01

标签: optimization ampl ipopt

我试图用IPOPT解决AMPL中一个非常简单的优化问题,如下所示:

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.

这是我的预期。 我无法理解为什么会发生这种情况,现在我不知道是否需要检查我要解决的所有问题,以便不收敛到错误的最优解决方案。因为这是一个非常简单的例子,它有点奇怪。

如果有人能帮助我,我将不胜感激。

由于

2 个答案:

答案 0 :(得分:1)

您已经确定了基本问题,但详细阐述了为什么这两个求解器会给出不同的结果:

IPOPT旨在涵盖广泛的优化问题,因此它使用了一些相当通用的数字优化方法。我不熟悉IPOPT的细节,但通常这种方法依赖于选择起点,查看起点附近的目标函数的曲率,并遵循曲率"下坡& #34;直到找到局部最优。不同的起点可能导致不同的结果。在这种情况下,IPOPT可能默认为起始点为零,因此它在该局部最小值之上。正如欧文的建议,如果你指定一个不同的起点,它可能会发现无限。

Gurobi是专门针对二次/线性问题而设计的,因此它使用了非常不同的方法,这些方法不易受局部最小问题的影响,并且对于二次方法可能更有效。但它并不支持更一般的目标函数。

答案 1 :(得分:0)

我想我明白为什么会这样。目标函数

 -(x1^2)+x1;

不凸。因此,给定的解决方案是局部最优的。

相关问题