How to find which constraint is violated from pyomo's ipopt interface?

微笑、不失礼 提交于 2019-12-12 19:04:34

问题


I am running an optimization problem using pyomo's ipopt solver. My problem is sort of complicated, and it is declared infeasible by IPOPT. I will not post the entire problem unless needed. But, one thing to note is, I am providing a warm start for the problem, which I thought would help prevent infeasibility from rearing its ugly head.

Here's the output from pyomo and ipopt when I set tee=True inside of the solver:

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...:      104
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:       57

Total number of variables............................:       31
                     variables with only lower bounds:        0
                variables with lower and upper bounds:        0
                     variables with only upper bounds:        0
Total number of equality constraints.................:       29
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  0.0000000e+00 1.00e+01 1.00e+02  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
WARNING: Problem in step computation; switching to emergency mode.
   1r 0.0000000e+00 1.00e+01 9.99e+02   1.0 0.00e+00  20.0 0.00e+00 0.00e+00R  1
WARNING: Problem in step computation; switching to emergency mode.
Restoration phase is called at point that is almost feasible,
  with constraint violation 0.000000e+00. Abort.
Restoration phase in the restoration phase failed.

Number of Iterations....: 1

                                   (scaled)                 (unscaled)
Objective...............:   0.0000000000000000e+00    0.0000000000000000e+00
Dual infeasibility......:   9.9999999999999986e+01    6.0938999999999976e+02
Constraint violation....:   1.0000000000000000e+01    1.0000000000000000e+01
Complementarity.........:   0.0000000000000000e+00    0.0000000000000000e+00
Overall NLP error.......:   9.9999999999999986e+01    6.0938999999999976e+02


Number of objective function evaluations             = 2
Number of objective gradient evaluations             = 2
Number of equality constraint evaluations            = 2
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 2
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 2
Total CPU secs in IPOPT (w/o function evaluations)   =      0.008
Total CPU secs in NLP function evaluations           =      0.000

EXIT: Restoration Failed!


    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
 model, tee=True)
          4 

/Library/<path to solvers.pyc> in solve(self, *args, **kwds)
    616                         result,
    617                         select=self._select_index,
--> 618                         default_variable_value=self._default_variable_value)
    619                     result._smap_id = None
    620                     result.solution.clear()

/Library/Frameworks<path to>/PyomoModel.pyc in load_from(self, results, allow_consistent_values_for_fixed_vars, comparison_tolerance_for_fixed_vars, ignore_invalid_labels, id, delete_symbol_map, clear, default_variable_value, select, ignore_fixed_vars)
    239             else:
    240                raise ValueError("Cannot load a SolverResults object "
--> 241                                 "with bad status: %s" % str(results.solver.status))
    242         if clear:
    243             #

ValueError: Cannot load a SolverResults object with bad status: error

You can actually see from the log outputted above, that there were only 2 constraint evaluates from this line:

Number of equality constraint evaluations            = 2

So, it actually was declared infeasible pretty quickly, so I imagine it won't be difficult to figure out which constraint was violated.

How do I find out which constraint was violated? Or which constraint is making it infeasible?

Here is a different question, but one that still is informative about IPOPT: IPOPT options for reducing constraint violation after fewer iterations

来源:https://stackoverflow.com/questions/44558507/how-to-find-which-constraint-is-violated-from-pyomos-ipopt-interface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!