Skip to content

Commit

Permalink
allow mathprogmodels to be passed in for compatibility with the publi…
Browse files Browse the repository at this point in the history
…shed paper
  • Loading branch information
karanveerm committed Jan 10, 2015
1 parent 3836d0c commit 6649193
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/solution.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import MathProgBase
export solve!

SolverOrModel = Union(MathProgBase.AbstractMathProgSolver, MathProgBase.AbstractMathProgModel)

function solve!(problem::Problem,
s::MathProgBase.AbstractMathProgSolver=get_default_solver();
s::SolverOrModel=get_default_solver();
warmstart=true)

m = MathProgBase.model(s)
if isa(s, MathProgBase.AbstractMathProgSolver)
m = MathProgBase.model(s)
else # it is already a model

This comment has been minimized.

Copy link
@mlubin

mlubin Jan 10, 2015

Member

Maybe print a deprecation warning here?

m = s
end

# TODO: This is a tiny, temporary hack that will be removed once SCS.jl or SCS
# starts to take care of symmetry constraints.
old_solver = get_default_solver()
set_default_solver(s)
if typeof(s).name.name == :SCSSolver
set_default_solver(s)
elseif typeof(s).name.name == :SCSMathProgModel
set_default_solver(Main.SCS.SCSSolver())
end

c, A, b, cones, var_to_ranges, vartypes = conic_problem(problem)
set_default_solver(old_solver)

Expand Down

0 comments on commit 6649193

Please sign in to comment.