IPOPT finds the optimal solution on the second solve!

23 views
Skip to first unread message

mahraz amini

unread,
Apr 20, 2018, 3:53:06 PM4/20/18
to AMPL Modeling Language
Hi all

usually when I try to solve sth with IPOPT, even if the problem is infeasible, IPOPT shows the running process and for example shows how many constraints the problem have and other general information of the problem but this time I was faced a strange problem. first time that I solve the problem it shows nothing, but the second time that I solve it, IPOPT returns optimal solution. like this:

-> ampl.eval('option solver ipopt ;'); 

-> ampl.solve()

(it returns nothing here!!!!)

-> solve_result  = ampl.getValue('solve_result_num')



solve_result =


    -1


so here, I just run the code again:


-> ampl.solve()


Ipopt 3.12.4: 


******************************************************************************

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...:     4439

Number of nonzeros in inequality constraint Jacobian.:     7888

Number of nonzeros in Lagrangian Hessian.............:       50


Total number of variables............................:     1610

                     variables with only lower bounds:        0

                variables with lower and upper bounds:       70

                     variables with only upper bounds:        0

Total number of equality constraints.................:     1360

Total number of inequality constraints...............:     2585

        inequality constraints with only lower bounds:        0

   inequality constraints with lower and upper bounds:     2585

        inequality constraints with only upper bounds:        0


iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls

   0  5.0001000e+03 1.31e+00 8.32e-02  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0

   1  5.0079602e+03 1.31e+00 2.71e+01  -1.0 1.68e+01    -  1.05e-02 7.73e-04f  1

   2  3.9278729e+03 1.17e+00 9.17e+00  -1.0 1.24e+00    -  3.65e-02 9.32e-02f  1

   3  2.7624370e+03 9.13e-01 2.49e+01  -1.0 4.52e-01    -  7.04e-01 1.99e-01f  1

   4  1.6350590e+03 7.87e-02 2.17e+01  -1.0 6.17e-01    -  2.98e-01 7.82e-01f  1

   5  8.6271513e+02 3.73e-13 2.34e-01  -1.0 1.53e-01    -  9.90e-01 1.00e+00f  1

   6  1.0292941e+03 1.98e-13 8.49e-13  -1.0 1.03e-01    -  1.00e+00 1.00e+00f  1

   7  1.0259140e+03 1.86e-13 6.85e-13  -2.5 6.57e-04    -  1.00e+00 1.00e+00f  1

   8  9.1964915e+02 2.02e-13 7.11e-04  -3.8 1.84e-02    -  9.96e-01 1.00e+00f  1

   9  3.5639825e+02 2.30e-13 4.23e-02  -5.7 9.45e-02    -  7.68e-01 1.00e+00f  1

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls

  10  7.9479322e+01 2.23e-13 9.26e-03  -5.7 1.85e-01    -  8.95e-01 1.00e+00f  1

  11  1.9247063e+01 2.72e-13 2.80e-14  -5.7 1.19e-01    -  1.00e+00 1.00e+00f  1

  12  6.9889052e+00 3.55e-13 9.99e-05  -8.6 4.59e-02    -  9.33e-01 1.00e+00f  1

  13  1.2789711e+00 4.20e-13 4.22e-04  -8.6 2.96e-01    -  4.85e-01 8.98e-01f  1

  14  2.9354384e-01 2.00e-13 6.84e-06  -8.6 4.49e-02    -  9.92e-01 1.00e+00f  1

  15  1.0626050e-01 2.41e-13 7.17e-14  -8.6 9.55e-03    -  1.00e+00 1.00e+00h  1

  16  6.3028082e-02 3.77e-13 5.27e-14  -8.6 1.37e-03    -  1.00e+00 1.00e+00h  1

  17  4.3933480e-03 3.27e-13 6.90e-08 -11.0 2.32e-03    -  9.99e-01 1.00e+00h  1

  18  1.1280540e-03 2.81e-13 8.08e-14 -11.0 1.02e-04    -  1.00e+00 1.00e+00h  1

  19  3.9735544e-04 3.93e-13 5.46e-14 -11.0 5.59e-05    -  1.00e+00 1.00e+00h  1

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls

  20  2.2989758e-04 3.19e-13 1.68e-14 -11.0 2.72e-05    -  1.00e+00 1.00e+00h  1


Number of Iterations....: 20


                                   (scaled)                 (unscaled)

Objective...............:   2.4678359201693643e-10    2.2989757642660348e-04

Dual infeasibility......:   1.6794654637445761e-14    1.5645490717250029e-08

Constraint violation....:   2.7491418973006631e-15    3.1883523599063324e-13

Complementarity.........:   5.3838886983188674e-11    5.0154994235157414e-05

Overall NLP error.......:   5.3838886983188674e-11    5.0154994235157414e-05



Number of objective function evaluations             = 21

Number of objective gradient evaluations             = 21

Number of equality constraint evaluations            = 21

Number of inequality constraint evaluations          = 21

Number of equality constraint Jacobian evaluations   = 21

Number of inequality constraint Jacobian evaluations = 21

Number of Lagrangian Hessian evaluations             = 20

Total CPU secs in IPOPT (w/o function evaluations)   =      0.295

Total CPU secs in NLP function evaluations           =      0.004


EXIT: Optimal So 

Ipopt 3.12.4: Optimal Solution Found


suffix ipopt_zU_out OUT;

suffix ipopt_zL_out OUT;



-> solve_result  = ampl.getValue('solve_result_num')


solve_result =


    0



so can anyone know why this happens and what is the meaning of this? 


Thanks,


Mahraz







AMPL Google Group

unread,
Apr 23, 2018, 6:01:17 AM4/23/18
to Ampl Modeling Language
Could you please provide a minimal example including the model so that we can try to reproduce this issue? We have tried with feasible and infeasible models and we were not able to reproduce this issue. It would also help to know the API version and the operating system.

--
Filipe Brandão
am...@googlegroups.com
{#HS:565710263-5767#}
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



mahraz amini

unread,
Apr 23, 2018, 9:32:56 AM4/23/18
to AMPL Modeling Language
I found in the objective I have a term 

min : (x-y)/y 

and x was variable and y was constant and some of the y values are zero and it does not give any error for that and honestly I don't know how it solves the problem on the second try. 

Thanks,

Mahraz
Reply all
Reply to author
Forward
0 new messages