Skip to content

Commit

Permalink
Merge pull request #135 from emreyamangil/solutionfix
Browse files Browse the repository at this point in the history
solution fix
  • Loading branch information
madeleineudell committed Apr 2, 2016
2 parents cf07d0e + 24d8740 commit a668039
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,30 @@ function populate_solution!(m::MathProgBase.AbstractConicModel,
problem::Problem,
var_to_ranges,
conic_constraints)
try
dual = MathProgBase.getdual(m)
problem.solution = Solution(MathProgBase.getsolution(m), dual,
MathProgBase.status(m), MathProgBase.getobjval(m))
dual = try
MathProgBase.getdual(m)
catch
problem.solution = Solution(MathProgBase.getsolution(m),
MathProgBase.status(m), MathProgBase.getobjval(m))
fill(NaN, MathProgBase.numconstr(m))
end

solution = try
MathProgBase.getsolution(m)
catch
fill(NaN, MathProgBase.numvar(m))
end

objective = try
MathProgBase.getobjval(m)
catch
NaN
end

if any(isnan(dual))
problem.solution = Solution(solution, MathProgBase.status(m), objective)
else
problem.solution = Solution(solution, dual, MathProgBase.status(m), objective)
end

populate_variables!(problem, var_to_ranges)

if problem.solution.has_dual
Expand Down

0 comments on commit a668039

Please sign in to comment.