From 14fab92b00bd146fc7ea539520c4c988600d4602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Thu, 13 Dec 2018 17:37:11 +0100 Subject: [PATCH 1/2] Add support for MOI v0.7 --- src/MathOptInterfaceMosek.jl | 7 ++++--- src/attributes.jl | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/MathOptInterfaceMosek.jl b/src/MathOptInterfaceMosek.jl index f5cc627..a08bc33 100644 --- a/src/MathOptInterfaceMosek.jl +++ b/src/MathOptInterfaceMosek.jl @@ -250,7 +250,7 @@ mutable struct MosekModel <: MOI.AbstractOptimizer conecounter :: Int ########################### - trm :: Rescode + trm :: Union{Nothing, Rescode} solutions :: Vector{MosekSolution} ########################### @@ -336,7 +336,7 @@ function MosekOptimizer(; kws...) Int[], # c_block_slack Int[], # c_coneid 0, # cone counter - Mosek.MSK_RES_OK,# trm + nothing,# trm MosekSolution[], true) # feasibility_sense end @@ -418,11 +418,12 @@ function MOI.empty!(model::MosekModel) model.c_block_slack = Int[] model.c_coneid = Int[] model.conecounter = 0 - model.trm = Mosek.MSK_RES_OK + model.trm = nothing model.solutions = MosekSolution[] model.feasibility = true end +MOIU.supports_default_copy_to(::MosekModel, copy_names::Bool) = !copy_names function MOI.copy_to(dest::MosekModel, src::MOI.ModelLike; copy_names=true) return MOIU.default_copy_to(dest, src, copy_names) end diff --git a/src/attributes.jl b/src/attributes.jl index d8520d4..693699e 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -486,8 +486,17 @@ end #### Status codes function MOI.get(m::MosekModel,attr::MOI.TerminationStatus) - if m.trm == MSK_RES_OK - MOI.Success + if m.trm === nothing + MOI.OptimizeNotCalled + elseif m.trm == MSK_RES_OK + if any(sol -> sol.solsta == MSK_SOL_STA_PRIM_INFEAS_CER, m.solutions) + MOI.Infeasible + elseif any(sol -> sol.solsta == MSK_SOL_STA_DUAL_INFEAS_CER, + m.solutions) + MOI.DualInfeasible + else + MOI.Optimal + end elseif m.trm == MSK_RES_TRM_MAX_ITERATIONS MOI.IterationLimit elseif m.trm == MSK_RES_TRM_MAX_TIME @@ -495,9 +504,9 @@ function MOI.get(m::MosekModel,attr::MOI.TerminationStatus) elseif m.trm == MSK_RES_TRM_OBJECTIVE_RANGE MOI.ObjectiveLimit elseif m.trm == MSK_RES_TRM_MIO_NEAR_REL_GAP - MOI.AlmostSuccess + MOI.AlmostOptimal elseif m.trm == MSK_RES_TRM_MIO_NEAR_ABS_GAP - MOI.AlmostSuccess + MOI.AlmostOptimal elseif m.trm == MSK_RES_TRM_MIO_NUM_RELAXS MOI.OtherLimit elseif m.trm == MSK_RES_TRM_MIO_NUM_BRANCHES @@ -505,12 +514,14 @@ function MOI.get(m::MosekModel,attr::MOI.TerminationStatus) elseif m.trm == MSK_RES_TRM_NUM_MAX_NUM_INT_SOLUTIONS MOI.SolutionLimit elseif m.trm == MSK_RES_TRM_STALL + println("STALL") MOI.SlowProgress elseif m.trm == MSK_RES_TRM_USER_CALLBACK MOI.Interrupted elseif m.trm == MSK_RES_TRM_MAX_NUM_SETBACKS MOI.OtherLimit elseif m.trm == MSK_RES_TRM_NUMERICAL_PROBLEM + println("NUMERICAL_PROBLEM") MOI.SlowProgress elseif m.trm == MSK_RES_TRM_INTERNAL MOI.OtherError From 5c1558c2528497a4658c83deacd048c278095fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Thu, 13 Dec 2018 17:37:35 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20MOI=20v0.6=20->=20v0.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- REQUIRE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REQUIRE b/REQUIRE index 98a16d6..0962221 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ julia 0.7 -MathOptInterface 0.6 0.7 +MathOptInterface 0.7 0.8 Mosek Compat 1