/
objective.jl
40 lines (32 loc) · 1.15 KB
/
objective.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
struct ObjectivePrimalBound <: MOI.AbstractModelAttribute end
struct ObjectiveDualBound <: MOI.AbstractModelAttribute end
"""
objectiveprimalbound!(model, pb)
Define a primal bound on the optimal objective value
(upper bound for a minimisation, lower bound for a maximisation).
"""
objectiveprimalbound!(model, value::Real) = MOI.set(model, ObjectivePrimalBound(), value)
"""
objectivedualbound!(model, db)
Define a dual bound on the optimal objective value.
(lower bound for a minimisation, upper bound for a maximisation)
"""
objectivedualbound!(model, value::Real) = MOI.set(model, ObjectiveDualBound(), value)
function MOI.set(
dest::MOIU.UniversalFallback, attribute::ObjectivePrimalBound, value
)
dest.modattr[attribute] = value
return
end
function MOI.set(
dest::MOIU.UniversalFallback, attribute::ObjectiveDualBound, value
)
dest.modattr[attribute] = value
return
end
function MOI.get(dest::MOIU.UniversalFallback, attribute::ObjectivePrimalBound)
return get(dest.modattr, attribute, nothing)
end
function MOI.get(dest::MOIU.UniversalFallback, attribute::ObjectiveDualBound)
return get(dest.modattr, attribute, nothing)
end