Skip to content

Commit

Permalink
Fix MOI wrapper if solve_mcp fails (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Jan 31, 2024
1 parent 72d8307 commit 8ce6f56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,12 @@ function MOI.optimize!(model::Optimizer)
jacobian_data_contiguous = true,
[k => v for (k, v) in model.ext[:kwargs]]...,
)
if x === nothing
x = fill(NaN, length(initial))
end
if info === nothing
info = Information()
end
model.ext[:solution] = Solution(status, x, info)
return
end
Expand Down
7 changes: 7 additions & 0 deletions test/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,13 @@ function test_user_defined_function()
return
end

function test_empty_model()
model = PATHSolver.Optimizer()
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == MOI.LOCALLY_SOLVED
return
end

end

TestMOIWrapper.runtests()

0 comments on commit 8ce6f56

Please sign in to comment.