Skip to content

Commit

Permalink
Run juliaformatter
Browse files Browse the repository at this point in the history
Cache solution_status eagerly
  • Loading branch information
DrChainsaw committed Aug 17, 2021
1 parent cf63d54 commit b9f4ac8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/MOI_wrapper/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -767,21 +767,23 @@ function MOI.optimize!(model::Optimizer)
t = time()
model.termination_status = Cbc_solve(model)
model.solve_time = time() - t
model.solution_status = _get_solution_status(model)
model.num_integers = Cbc_getNumIntegers(model)
if MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT
model.primal_solution_cache = _unsafe_wrap_cbc_array(
model,
Cbc_getColSolution,
Cbc_getNumCols(model))
model,
Cbc_getColSolution,
Cbc_getNumCols(model),
)
model.primal_constraint_cache = _unsafe_wrap_cbc_array(
model,
Cbc_getRowActivity,
Cbc_getNumRows(model))
model,
Cbc_getRowActivity,
Cbc_getNumRows(model),
)
end
return
end


function MOI.get(model::Optimizer, ::MOI.SolveTime)
return model.solve_time
end
Expand Down Expand Up @@ -917,9 +919,6 @@ function MOI.get(model::Optimizer, ::MOI.ResultCount)
end

function MOI.get(model::Optimizer, ::MOI.TerminationStatus)
if model.termination_status != -1 && model.solution_status == MOI.OPTIMIZE_NOT_CALLED
model.solution_status = _get_solution_status(model)
end
return model.solution_status
end
function _get_solution_status(model::Optimizer)
Expand Down

0 comments on commit b9f4ac8

Please sign in to comment.