-
Notifications
You must be signed in to change notification settings - Fork 6
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 #166
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #166 +/- ##
==========================================
- Coverage 94.73% 90.20% -4.54%
==========================================
Files 13 13
Lines 703 745 +42
==========================================
+ Hits 666 672 +6
- Misses 37 73 +36 ☔ View full report in Codecov by Sentry. |
::MOI.VariablePrimalStart, | ||
::Type{MOI.VariableIndex}, | ||
) | ||
return true |
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.
This needs to check whether the inner optimizer supports ConstraintDualStart
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.
It's a bit tricky because we don't know the type of constraints. The inner may not support equality constraints in which case we cannot even ask for whether the solver supports ScalarAffineFunction
-in-EqualTo
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.
Yeah I don't know what a good answer is here
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.
I think I have an idea that I'll try next week
if vi in keys(primal_dual_map.constrained_var_idx) | ||
error( | ||
"Setting starting value for variables constrained at creation is not supported yet", | ||
) |
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.
This should throw MOI.SetAttributeNotAllowed{MOI.VariablePrimalStart}
@@ -330,23 +389,53 @@ function MOI.get( | |||
ci_dual = primal_dual_map.constrained_var_dual[ci_primal] | |||
return _get_at_index( | |||
optimizer, | |||
MOI.ConstraintDual(), | |||
_dual_attribute(attr), | |||
ci_primal, | |||
ci_dual, | |||
idx, | |||
) | |||
else | |||
return -MOI.get( |
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.
The -
does not account for VariablePrimalStart
returning nothing
src/MOI_wrapper.jl
Outdated
::Union{MOI.ConstraintDualStart,MOI.ConstraintPrimalStart}, | ||
::Type{<:MOI.ConstraintIndex}, | ||
) | ||
return true |
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.
Needs to check the inner optimizer supports VariablePrimalStart
. I don't know if ConstraintPrimalStart
makes sense to support?
end | ||
|
||
function _dual_attribute( | ||
::Union{MOI.VariablePrimalStart,MOI.ConstraintPrimalStart}, |
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.
I know know that it makes sense to support MOI.ConstraintPrimalStart
?
if ci in keys(primal_dual_map.constrained_var_dual) | ||
error( | ||
"Setting starting value for variables constrained at creation is not supported yet", | ||
) |
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.
SetAttributeNotAllowed
This also fixes a bug: the
result_index
were ignored and we would invariably query the first solution.result_index
bugCloses #165