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

Definition of primal solution? #212

Open
baggepinnen opened this issue Aug 31, 2022 · 3 comments
Open

Definition of primal solution? #212

baggepinnen opened this issue Aug 31, 2022 · 3 comments

Comments

@baggepinnen
Copy link
Contributor

I'm a bit confused about how to interpret the result
The example https://madnlp.github.io/MadNLP.jl/dev/quickstart/ contains two variables, but

ips.x

4-element Vector{Float64}:
 -0.7921232178470456
 -1.2624298435831807
  0.9999999900052515
  0.801605892122408

has length 4. What is the definition of ips.x and which variables correspond to x[1:2]?

Another question, how do I interpret the objective value at the solution?

julia> ips.obj_val
360.37976240508465

julia> ips.obj_scale
1-element Vector{Float64}:
 1.0

in this case the scaling is 1 so I assume that the actual, unscaled, objective value is given by ips.obj_val. If the scale is not 1, do I compute the unscaled value as ips.obj_val * ips.obj_scale?

@baggepinnen
Copy link
Contributor Author

I guess the additional variables are slack variables? If this is the case, it would be nice to mention this in the docs as well as document in what order standard and slack variables appear 😄

@sshin23
Copy link
Member

sshin23 commented Aug 31, 2022

yes, @baggepinnen ips.x is the original primal variable + slack variables, which we treat as MadNLP's internal variable. We'll look into whether there could be less confusing naming for this and add a note to the documentation

@frapac
Copy link
Member

frapac commented Aug 31, 2022

I think it's not safe to access to the solution in the solver's attributes as we are doing right now. I would suggest adding custom getters to return the solution in a safe way. Something like:

get_primal(ips) 
get_dual(ips) 
get_slack(ips) 

Again, we might duplicate some works with NLPModels. But I am not sure what the status of their API currently is.

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