Created
October 27, 2019 21:32
-
-
Save ericphanson/9ab9f8460bbe5200be82d0b0cb55ecd5 to your computer and use it in GitHub Desktop.
Problem trying to warmstart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using SCS | |
using MathOptInterface # MathOptInterface v0.9.6 | |
const MOI = MathOptInterface | |
const MOIU = MOI.Utilities | |
const MOIB = MOI.Bridges | |
function make_model(vector) | |
optimizer = SCS.Optimizer(verbose=false) | |
T = Float64 | |
model = MOIB.full_bridge_optimizer( | |
MOIU.CachingOptimizer( | |
MOIU.UniversalFallback(MOIU.Model{T}()), | |
optimizer | |
), | |
T | |
) | |
vars = MOI.add_variables(model, 3) | |
# Add objective | |
obj_terms = [ MOI.ScalarAffineTerm(one(T), vars[k]) for k in 1:3 ] | |
obj = MOI.ScalarAffineFunction{T}(obj_terms, zero(T)) | |
MOI.set(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}(), obj) | |
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) | |
# Add constraint | |
VAF = MOI.VectorAffineFunction{T}([ MOI.VectorAffineTerm{T}(k, MOI.ScalarAffineTerm{T}(vector[k], vars[k])) for k = 1:3], zeros(T, 3)) | |
constr_indices = MOI.add_constraint(model, VAF, MOI.Zeros(3)) | |
return model, constr_indices | |
end | |
vector = rand(3) | |
model, constr_indices = make_model(vector) | |
MOI.optimize!(model) # works | |
dual_value = MOI.get(model, MOI.ConstraintDual(), constr_indices) | |
# Get a fresh model | |
model, constr_indices = make_model(vector) | |
# Attempt to warmstart | |
MOI.set(model, MOI.ConstraintDualStart(), constr_indices, dual_value) # works | |
MOI.optimize!(model) # errors |
Should be fixed by jump-dev/MathOptInterface.jl#941
I can confirm it works for me on the brand new 0.9.7 :). Thanks very much!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The error is
I get the same error on MOI master.