-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add support for starting values #111
Conversation
Using JuMP master, MOI v0.6.1 and this branch I am getting,
|
SCS does not support quadratic objective function. We might create a bridge that transforms into SOC constraint in MOI but this is not done yet. No change should be done in SCS for that, this is a missing feature in MOI. |
Once we have a bridge to move the objective to a constraint as described in jump-dev/MathOptInterface.jl#529, it remains to transform to quadratic constraint to a SOC constraint but there is an open PR for that: |
The |
@@ -259,13 +260,46 @@ function MOIU.load_variables(optimizer::Optimizer, nvars::Integer) | |||
b = zeros(m) | |||
c = zeros(nvars) | |||
optimizer.data = ModelData(m, nvars, I, J, V, b, 0., c) | |||
if length(optimizer.sol.primal) != nvars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What could the length be if not nvars
? Would isempty
also work as a test? Same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sol
contains the solution of the previous optimization. If the user has added new variables, then it is not nvars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this interface allow adding variables and/or constraints?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can copy a model with a different number of variables/constraints. Normally, they will arrive in the same order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this if
be replaced with resize!
then?
I think there may be a deeper issue here. As far as I can tell PowerModels is posting a linear objective in the JuMP model. See this code, https://github.com/lanl-ansi/PowerModels.jl/blob/moi/src/core/objective.jl#L104 Is it possible that JuMP is interpreting the objective as quadratic when it is linear? |
Do we have a test for this functionality anywhere? |
Do you have a test were the model has conic constraints and a linear objective? |
In any case, this PR seems to have resolved #109, should we move this later point to a separate thread? |
Yes we can open an issue on JuMP, if you could produce a MWE producing a quadratic objective when it should be linear, it would help. It is probably because of a promotion that shouldn't happen. @objective(model, [1, 2]' * [x, y]) if the product is handled by a function that start by promoting the two vectors to the same type, it will promote them to affine expressions and hence the result would be quadratic. |
@@ -259,13 +260,46 @@ function MOIU.load_variables(optimizer::Optimizer, nvars::Integer) | |||
b = zeros(m) | |||
c = zeros(nvars) | |||
optimizer.data = ModelData(m, nvars, I, J, V, b, 0., c) | |||
if length(optimizer.sol.primal) != nvars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this interface allow adding variables and/or constraints?
@blegat, I confirmed on the latest commit on this branch I still have the issue with the objective function being quadratic. Probably the starting value is improved; but I don't know yet. On a side note, I never used to provide starting values to SCS in PowerModels. Now I am because of the all or nothing start value semantics. |
@blegat good news, I found a bug in my code, which was the cause of the quadratic objective function. That is fixed now. Now I am getting this error,
Recommendations? |
This cone is not supported by SCS and should be bridged. It should be bridged automatically if you use JuMP master with MOI v0.6.1. |
Same thing. I just realized that you might get the error you give in #111 (comment) if you do not provide the solver in the |
To finish up this discussion. You are correct, specifying the optimizer in the JuMP model constructor resolved the most recent issue. The only remaining issue I have at the moment is with setting the solver parameters (i.e. #113). In any case, this starting point fix is working great for me. |
@ccoffrin Can you test it and report whether it works as expected for your use case ?
Closes #109