Skip to content
This repository was archived by the owner on Feb 9, 2020. It is now read-only.

Commit d7c1be9

Browse files
authored
Merge pull request #58 from JuliaOpt/bl/moi7
Add support for MOI v0.7
2 parents 5652c09 + 5c1558c commit d7c1be9

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
julia 0.7
2-
MathOptInterface 0.6 0.7
2+
MathOptInterface 0.7 0.8
33
Mosek
44
Compat 1

src/MathOptInterfaceMosek.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ mutable struct MosekModel <: MOI.AbstractOptimizer
250250
conecounter :: Int
251251

252252
###########################
253-
trm :: Rescode
253+
trm :: Union{Nothing, Rescode}
254254
solutions :: Vector{MosekSolution}
255255

256256
###########################
@@ -336,7 +336,7 @@ function MosekOptimizer(; kws...)
336336
Int[], # c_block_slack
337337
Int[], # c_coneid
338338
0, # cone counter
339-
Mosek.MSK_RES_OK,# trm
339+
nothing,# trm
340340
MosekSolution[],
341341
true) # feasibility_sense
342342
end
@@ -418,11 +418,12 @@ function MOI.empty!(model::MosekModel)
418418
model.c_block_slack = Int[]
419419
model.c_coneid = Int[]
420420
model.conecounter = 0
421-
model.trm = Mosek.MSK_RES_OK
421+
model.trm = nothing
422422
model.solutions = MosekSolution[]
423423
model.feasibility = true
424424
end
425425

426+
MOIU.supports_default_copy_to(::MosekModel, copy_names::Bool) = !copy_names
426427
function MOI.copy_to(dest::MosekModel, src::MOI.ModelLike; copy_names=true)
427428
return MOIU.default_copy_to(dest, src, copy_names)
428429
end

src/attributes.jl

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,31 +486,42 @@ end
486486

487487
#### Status codes
488488
function MOI.get(m::MosekModel,attr::MOI.TerminationStatus)
489-
if m.trm == MSK_RES_OK
490-
MOI.Success
489+
if m.trm === nothing
490+
MOI.OptimizeNotCalled
491+
elseif m.trm == MSK_RES_OK
492+
if any(sol -> sol.solsta == MSK_SOL_STA_PRIM_INFEAS_CER, m.solutions)
493+
MOI.Infeasible
494+
elseif any(sol -> sol.solsta == MSK_SOL_STA_DUAL_INFEAS_CER,
495+
m.solutions)
496+
MOI.DualInfeasible
497+
else
498+
MOI.Optimal
499+
end
491500
elseif m.trm == MSK_RES_TRM_MAX_ITERATIONS
492501
MOI.IterationLimit
493502
elseif m.trm == MSK_RES_TRM_MAX_TIME
494503
MOI.TimeLimit
495504
elseif m.trm == MSK_RES_TRM_OBJECTIVE_RANGE
496505
MOI.ObjectiveLimit
497506
elseif m.trm == MSK_RES_TRM_MIO_NEAR_REL_GAP
498-
MOI.AlmostSuccess
507+
MOI.AlmostOptimal
499508
elseif m.trm == MSK_RES_TRM_MIO_NEAR_ABS_GAP
500-
MOI.AlmostSuccess
509+
MOI.AlmostOptimal
501510
elseif m.trm == MSK_RES_TRM_MIO_NUM_RELAXS
502511
MOI.OtherLimit
503512
elseif m.trm == MSK_RES_TRM_MIO_NUM_BRANCHES
504513
MOI.NodeLimit
505514
elseif m.trm == MSK_RES_TRM_NUM_MAX_NUM_INT_SOLUTIONS
506515
MOI.SolutionLimit
507516
elseif m.trm == MSK_RES_TRM_STALL
517+
println("STALL")
508518
MOI.SlowProgress
509519
elseif m.trm == MSK_RES_TRM_USER_CALLBACK
510520
MOI.Interrupted
511521
elseif m.trm == MSK_RES_TRM_MAX_NUM_SETBACKS
512522
MOI.OtherLimit
513523
elseif m.trm == MSK_RES_TRM_NUMERICAL_PROBLEM
524+
println("NUMERICAL_PROBLEM")
514525
MOI.SlowProgress
515526
elseif m.trm == MSK_RES_TRM_INTERNAL
516527
MOI.OtherError

0 commit comments

Comments
 (0)