MadNLP.jl
MadNLP.jl copied to clipboard
Definition of primal solution?
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
?
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 :smile:
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
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.