@@ -11,45 +11,6 @@ struct ObjectiveFunctionAttribute{A,F} <: MOI.AbstractModelAttribute
1111 attr:: A
1212end
1313
14- """
15- struct ObjectiveDualStart <: MOI.AbstractModelAttribute end
16-
17- If the objective function had a dual, it would be `-1` for the Lagrangian
18- function to be the same.
19- When the `MOI.Bridges.Objective.SlackBridge` is used, it creates a constraint.
20- The dual of this constraint is therefore `-1` as well.
21- When setting this attribute, it allows to set the constraint dual of this
22- constraint.
23- """
24- struct ObjectiveDualStart <: MOI.AbstractModelAttribute end
25- # Defining it for `MOI.set` leads to ambiguity
26- function MOI. throw_set_error_fallback (
27- :: MOI.ModelLike ,
28- :: ObjectiveDualStart ,
29- value,
30- )
31- return nothing
32- end
33-
34- """
35- struct ObjectiveSlackGapPrimalStart <: MOI.AbstractModelAttribute end
36-
37- If the objective function had a dual, it would be `-1` for the Lagrangian
38- function to be the same.
39- When the `MOI.Bridges.Objective.SlackBridge` is used, it creates a constraint.
40- The dual of this constraint is therefore `-1` as well.
41- When setting this attribute, it allows to set the constraint dual of this
42- constraint.
43- """
44- struct ObjectiveSlackGapPrimalStart <: MOI.AbstractModelAttribute end
45- function MOI. throw_set_error_fallback (
46- :: MOI.ModelLike ,
47- :: ObjectiveSlackGapPrimalStart ,
48- value,
49- )
50- return nothing
51- end
52-
5314function MOI. get (
5415 b:: MOI.Bridges.AbstractBridgeOptimizer ,
5516 attr:: ObjectiveFunctionAttribute{A,F} ,
10061
10162function MOI. set (
10263 b:: MOI.Bridges.AbstractBridgeOptimizer ,
103- attr:: Union {
104- ObjectiveDualStart,
105- ObjectiveSlackGapPrimalStart,
106- ForwardObjectiveFunction,
107- },
64+ attr:: ForwardObjectiveFunction ,
10865 value,
10966)
11067 if MOI. Bridges. is_objective_bridged (b)
@@ -121,34 +78,6 @@ function MOI.set(
12178 end
12279end
12380
124- function MOI. set (
125- model:: MOI.ModelLike ,
126- :: ObjectiveFunctionAttribute{ObjectiveDualStart} ,
127- b:: MOI.Bridges.Objective.SlackBridge ,
128- value,
129- )
130- return MOI. set (model, MOI. ConstraintDualStart (), b. constraint, value)
131- end
132-
133- function MOI. set (
134- model:: MOI.ModelLike ,
135- :: ObjectiveFunctionAttribute{ObjectiveSlackGapPrimalStart} ,
136- b:: MOI.Bridges.Objective.SlackBridge{T} ,
137- value,
138- ) where {T}
139- # `f(x) - slack = value` so `slack = f(x) - value`
140- fun = MOI. get (model, MOI. ConstraintFunction (), b. constraint)
141- set = MOI. get (model, MOI. ConstraintSet (), b. constraint)
142- MOI. Utilities. operate! (- , T, fun, MOI. constant (set))
143- # `fun = f - slack` so we remove the term `-slack` to get `f`
144- f = MOI. Utilities. remove_variable (fun, b. slack)
145- f_val = MOI. Utilities. eval_variables (f) do v
146- return MOI. get (model, MOI. VariablePrimalStart (), v)
147- end
148- MOI. set (model, MOI. VariablePrimalStart (), b. slack, f_val - value)
149- return MOI. set (model, MOI. ConstraintPrimalStart (), b. constraint, value)
150- end
151-
15281function _copy_dual (dest:: MOI.ModelLike , src:: MOI.ModelLike , index_map)
15382 vis_src = MOI. get (src, MOI. ListOfVariableIndices ())
15483 MOI. set (
@@ -173,8 +102,10 @@ function _copy_dual(dest::MOI.ModelLike, src::MOI.ModelLike, index_map)
173102 MOI. ConstraintDual (),
174103 )
175104 end
176- MOI. set (dest, ObjectiveDualStart (), - 1.0 )
177- return MOI. set (dest, ObjectiveSlackGapPrimalStart (), 0.0 )
105+ # Same as in `JuMP.set_start_values`
106+ # Needed for models which bridge `min f(x)` into `min t such that t >= f(x)`.
107+ MOI. set (dest, MOI. Bridges. Objective. SlackBridgePrimalDualStart (), nothing )
108+ return
178109end
179110
180111function _copy_constraint_start (
0 commit comments