diff --git a/Project.toml b/Project.toml index 0af1310..43e23dc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ParametricOptInterface" uuid = "0ce4ce61-57bf-432b-a095-efac525d185e" authors = ["Tomás Gutierrez "] -version = "0.5.0" +version = "0.5.1" [deps] MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" diff --git a/src/ParametricOptInterface.jl b/src/ParametricOptInterface.jl index 158852c..e0ab8fc 100644 --- a/src/ParametricOptInterface.jl +++ b/src/ParametricOptInterface.jl @@ -689,6 +689,19 @@ function MOI.get(model::Optimizer, ::MOI.RawStatusString) return MOI.get(model.optimizer, MOI.RawStatusString()) end +function MOI.supports(model::Optimizer, attr::MOI.AbstractOptimizerAttribute) + return MOI.supports(model.optimizer, attr) +end + +function MOI.get(model::Optimizer, attr::MOI.AbstractOptimizerAttribute) + return MOI.get(model.optimizer, attr) +end + +function MOI.set(model::Optimizer, attr::MOI.AbstractOptimizerAttribute, value) + MOI.set(model.optimizer, attr, value) + return +end + function MOI.get(model::Optimizer, ::MOI.NumberOfConstraints{F,S}) where {F,S} return length(MOI.get(model, MOI.ListOfConstraintIndices{F,S}())) end diff --git a/test/jump_tests.jl b/test/jump_tests.jl index a732df7..9d355b5 100644 --- a/test/jump_tests.jl +++ b/test/jump_tests.jl @@ -1055,3 +1055,12 @@ function test_affine_parametric_objective() @test objective_value(model) ≈ 1.5 @test value(objective_function(model)) ≈ 1.5 end + +function test_abstract_optimizer_attributes() + model = Model(() -> POI.Optimizer(GLPK.Optimizer())) + set_attribute(model, "tm_lim", 60 * 1000) + attr = MOI.RawOptimizerAttribute("tm_lim") + @test MOI.supports(unsafe_backend(model), attr) + @test get_attribute(model, "tm_lim") ≈ 60 * 1000 + return +end