Skip to content

Commit 9c82431

Browse files
committed
Fix set/get for RawStatusString
1 parent 58caaa1 commit 9c82431

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

src/attributes.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ model with the dual model.
2828
function dual_attribute end
2929

3030
dual_attribute(attr::MOI.ResultCount) = attr
31+
dual_attribute(attr::MOI.RawStatusString) = attr
3132

3233
dual_attribute(::MOI.VariableName) = MOI.ConstraintName()
3334

test/Tests/test_attributes.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,32 @@ function test_conic()
348348
return
349349
end
350350

351+
function test_raw_status_string()
352+
@test Dualization.dual_attribute(MOI.RawStatusString()) ==
353+
MOI.RawStatusString()
354+
T = Float64
355+
mock = MOI.Utilities.MockOptimizer(
356+
MOI.Utilities.UniversalFallback(MOI.Utilities.Model{T}());
357+
eval_variable_constraint_dual = false,
358+
)
359+
cached = MOI.Utilities.CachingOptimizer(
360+
MOI.Utilities.UniversalFallback(MOI.Utilities.Model{T}()),
361+
MOI.Utilities.MANUAL,
362+
)
363+
dual = Dualization.DualOptimizer(mock)
364+
MOI.Utilities.reset_optimizer(cached, dual)
365+
x = MOI.add_variable(cached)
366+
c = MOI.add_constraint(cached, T(1) * x, MOI.GreaterThan(T(0)))
367+
MOI.set(cached, MOI.ObjectiveSense(), MOI.MIN_SENSE)
368+
MOI.set(cached, MOI.ObjectiveFunction{typeof(T(1) * x)}(), T(1) * x)
369+
MOI.Utilities.attach_optimizer(cached)
370+
MOI.optimize!(cached)
371+
inner_mock = dual.dual_problem.dual_model.model.optimizer
372+
MOI.set(inner_mock, MOI.RawStatusString(), "mock_status")
373+
@test MOI.get(cached, MOI.RawStatusString()) == "mock_status"
374+
return
375+
end
376+
351377
end # module
352378

353379
TestAttributes.runtests()

0 commit comments

Comments
 (0)