Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we add debugging functionality? #28

Open
timmercy opened this issue Apr 21, 2016 · 7 comments
Open

Should we add debugging functionality? #28

timmercy opened this issue Apr 21, 2016 · 7 comments

Comments

@timmercy
Copy link
Member

Maybe we should add an option to show which constraints are violated in the case of an infeasible problem?

@rubenvanparys
Copy link
Member

ok maybe, but

  • how are you implement this? Evaluate every constraint and compare it with lbg, ubg. This is possible as the optilayer foresees the (numeric) evaluation of constraints.
  • I don't know if this information is valuable. I am not sure whether only the critical constraints will be infeasible if ipopt returns 'infeasible problem'. In my opinion ipopt returns just rubbish in this case...

@jgillis
Copy link
Contributor

jgillis commented Apr 22, 2016

In my experience such information is valuable.
Especially when you see ipopt during its iterations to struggle to meet some constraints.
It can be a helpful way to spot mistakes in your formulation.

@timmercy
Copy link
Member Author

Joris showed me once how to do this. If I recall correctly:
Before solving:
from casadi.tools import reportBounds
solver.setOption('warn_initial_bounds', True)
solver.setOption('constr_viol_tol', 1e-4)
After soving:
solver.reportConstraints()
reportBounds(nlp.getOutput("g"),solver.getInput("lbg"),solver.getInput("ubg"), showNonViolating=False)

You get a list in which you can see which constraints are fulfilled and which are violated. The only downside is that you don't get the name of the constraint, so you have to couple your list to your optimization formulation.

Is this implementation still possible in CasADi 3.0 or are there any other/better ways to do this?

@jgillis
Copy link
Contributor

jgillis commented Apr 22, 2016

well okay that method is lame; i'm sure you can do it better..

@jgillis
Copy link
Contributor

jgillis commented Apr 22, 2016

(if you used casadi structures, you can easily request readable labels for all entries of g)

@timmercy
Copy link
Member Author

Okay, I used this method indeed before CasADi structures were used

@rubenvanparys
Copy link
Member

We do use casadi structs for constraints

Okay, I used this method indeed before CasADi structures were used

You are receiving this because you commented.
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-213275143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants