diff --git a/src/MOI_wrapper.jl b/src/MOI_wrapper.jl index 899d011..cc53c3a 100644 --- a/src/MOI_wrapper.jl +++ b/src/MOI_wrapper.jl @@ -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 diff --git a/test/MOI_wrapper.jl b/test/MOI_wrapper.jl index 4c2e008..888d776 100644 --- a/test/MOI_wrapper.jl +++ b/test/MOI_wrapper.jl @@ -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()