Skip to content

Commit 0b3ee89

Browse files
authored
Set SlackBridgePrimalDualStart in set_start_values (#3422)
1 parent 0d1d90a commit 0b3ee89

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
1313
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1414

1515
[compat]
16-
MathOptInterface = "1.17"
16+
MathOptInterface = "1.18"
1717
MutableArithmetics = "1"
1818
OrderedCollections = "1"
1919
SnoopPrecompile = "1"

docs/Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Ipopt = "=1.4.1"
4242
JSON = "0.21"
4343
JSONSchema = "1"
4444
Literate = "2.8"
45-
MathOptInterface = "=1.17.1"
45+
MathOptInterface = "=1.18.0"
4646
MultiObjectiveAlgorithms = "=1.0.0"
4747
Plots = "1"
4848
SCS = "=1.2.0"

src/optimizer_interface.jl

+2
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,8 @@ function set_start_values(
11511151
for (ci, dual_start) in constraint_dual
11521152
set_dual_start_value(ci, dual_start)
11531153
end
1154+
# Needed for models which bridge `min f(x)` into `min t; t >= f(x)`.
1155+
MOI.set(model, MOI.Bridges.Objective.SlackBridgePrimalDualStart(), nothing)
11541156
return
11551157
end
11561158

test/test_model.jl

+14
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,20 @@ function test_model_quad_to_soc_start_values()
11101110
return
11111111
end
11121112

1113+
function test_SlackBridgePrimalDualStart()
1114+
inner = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}())
1115+
mock = MOI.Utilities.MockOptimizer(inner)
1116+
model = direct_model(MOI.Bridges.Objective.Slack{Float64}(mock))
1117+
@variable(model, x, start = 1.0)
1118+
@objective(model, Min, x^2)
1119+
set_start_values(model; variable_primal_start = start_value)
1120+
F, S = MOI.ScalarQuadraticFunction{Float64}, MOI.LessThan{Float64}
1121+
ci = first(MOI.get(inner, MOI.ListOfConstraintIndices{F,S}()))
1122+
@test MOI.get(inner, MOI.ConstraintPrimalStart(), ci) == 0.0
1123+
@test MOI.get(inner, MOI.ConstraintDualStart(), ci) == -1.0
1124+
return
1125+
end
1126+
11131127
function test_keyword_getindex()
11141128
err = JuMP._get_index_keyword_indexing_error()
11151129
model = Model()

0 commit comments

Comments
 (0)