diff --git a/src/MOI_wrapper/MOI_wrapper.jl b/src/MOI_wrapper/MOI_wrapper.jl index 4c2630e..fb041bf 100644 --- a/src/MOI_wrapper/MOI_wrapper.jl +++ b/src/MOI_wrapper/MOI_wrapper.jl @@ -90,6 +90,10 @@ function MOI.Utilities.set_from_constants( return NormNuclearCone(row_dim, col_dim) end +function MOI.Utilities.modify_constants(x::_SetConstants, rows, value) + return MOI.Utilities.modify_constants(x.b, rows, value) +end + const OptimizerCache{T} = MOI.Utilities.GenericModel{ Cdouble, MOI.Utilities.ObjectiveContainer{Cdouble}, diff --git a/test/MOI_wrapper.jl b/test/MOI_wrapper.jl index 866e5c2..1f2be68 100644 --- a/test/MOI_wrapper.jl +++ b/test/MOI_wrapper.jl @@ -561,6 +561,18 @@ function test_get_function_constants() return end +function test_modify_constants() + model = MOI.instantiate(SCS.Optimizer; with_cache_type = Float64) + x = MOI.add_variable(model) + f = MOI.Utilities.vectorize([1.0 * x - 1.0]) + c = MOI.add_constraint(model, f, MOI.Zeros(1)) + MOI.Utilities.final_touch(model, nothing) + MOI.modify(model, c, MOI.VectorConstantChange([-2.0])) + g = MOI.get(model, MOI.ConstraintFunction(), c) + @test g.constants == [-2.0] + return +end + end # module TestSCS.runtests()