Initial values incorrect?
See original GitHub issueI build a quite complicated NLP using the Problem interface ( https://cyipopt.readthedocs.io/en/stable/tutorial.html#problem-interface ), which is working fine.
I am using a lot of class variables within the Problem class.
But I noticed a strange initial behaviour where the initial objective (and constraints) are wrong evaluated, see blow.
Initial objective / constraints values (from a previous optimization) when i manually evaluate them
>>> prob.objective(x0)
4974321.999640268
EQ constraints == 0
>>> np.abs(prob.constraints(x0)[:prob.n_eq_constr]).max()
5.045876605436206e-09
INEQ constraints > 0
>>> prob.constraints(x0)[prob.n_eq_constr:].min()
-1.328551330130685e-06
When using the solve method, the initial values are off by a factor of 52 (objective) and 1e8 (constraints)
x, info = nlp.solve(x0)
This is Ipopt version 3.14.10, running with linear solver MUMPS 5.2.1.
Number of nonzeros in equality constraint Jacobian...: 10692
Number of nonzeros in inequality constraint Jacobian.: 3576
Number of nonzeros in Lagrangian Hessian.............: 5185
Total number of variables............................: 1582
variables with only lower bounds: 447
variables with lower and upper bounds: 241
variables with only upper bounds: 0
Total number of equality constraints.................: 510
Total number of inequality constraints...............: 1788
inequality constraints with only lower bounds: 1788
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 2.5866283e+08 3.49e+01 1.90e+01 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0
Number of Iterations....: 0
(scaled) (unscaled)
Objective...............: 2.5999807855894869e+02 2.5866283240229580e+08
Dual infeasibility......: 1.9000013004444856e+01 1.8902436535875730e+07
Constraint violation....: 3.4933812241858782e+01 3.4933812241858782e+01
Variable bound violation: 0.0000000000000000e+00 0.0000000000000000e+00
Complementarity.........: 4.4750645232231720e+04 4.4520823814376411e+10
Overall NLP error.......: 4.4750645232231720e+04 4.4520823814376411e+10
Number of objective function evaluations = 1
Number of objective gradient evaluations = 1
Number of equality constraint evaluations = 1
Number of inequality constraint evaluations = 1
Number of equality constraint Jacobian evaluations = 1
Number of inequality constraint Jacobian evaluations = 1
Number of Lagrangian Hessian evaluations = 0
Total seconds in IPOPT = 0.037
EXIT: Maximum Number of Iterations Exceeded.
Iteration 0 objective 2.5866283240229580e+08
↔ 4974321.999640268
Iteration 0 constraints 3.4933812241858782e+01
↔ 1.328551330130685e-06
Any ideas what could be wrong?
Issue Analytics
- State:
- Created 9 months ago
- Comments:7
Top Results From Across the Web
Initial value problem - Wikipedia
In multivariable calculus, an initial value problem (IVP) is an ordinary differential equation together with an initial condition which specifies the value ...
Read more >Initial Value Problem (Initial Condition) - Statistics How To
When a differential equation specifies an initial condition, the equation is called an initial value problem. Initial conditions require you to search for...
Read more >Initial Value Problem & Examples - Video & Lesson Transcript
Initial value problems in calculus concern differential equations with a known initial condition that specifies the value of the function at ...
Read more >Initial-Value Problems | Calculus II - Lumen Learning
A differential equation together with one or more initial values is called an initial-value problem. The general rule is that the number of...
Read more >Formik bad initialValues between 2 forms - Stack Overflow
The problem starts when I switch between forms (without touching the form) the initial values does not change. Ex. I'm in LoginForm and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unfortunately, I don’t know I’m afraid.
I’m personally not familiar with any of these settings.
This question now might be better asked on one of the Ipopt channels. This Ipopt documentation suggests using the issue tracker or discussions on the Ipopt GitHub.
I will close this now as it appears to no longer be a CyIpopt-specific issue. Please feel free to reopen if you need further help.
My current hypothesis on why you’re seeing this:
In iteration zero, Ipopt evaluates the problem at your initial guess. Therefore, for the hs071 problem, you’d expect the unscaled objective function to evaluate to
16.0
. However, Ipopt appears to adjusts the supplied initial guess slightly in situations where the initial guess is at or close to the decision variable bounds. For the hs071 problem, lb <= x0 <= ub is[1, 1, 1, 1] <= [1, 5, 5, 1] <= [5, 5, 5, 5]
. As all initial guess values are exactly equal to either the lower or upper bound, Ipopt adjusts the initial guess to[1.00999999 4.96000005 4.96000005 1.00999999]
for the zeroth iteration evaluation.Without knowing what your objective function implementation looks like, or what bounds you’re using relative to your initial guess, I can’t comment whether it’s possible that this is the case for your problem.