Skip to content

Commit

Permalink
Only allow a solver to be passed into solve, and not a model directly…
Browse files Browse the repository at this point in the history
…. Tiny temporary hack so that SCSSolver will work and add symmetry constraints
  • Loading branch information
karanveerm committed Jan 6, 2015
1 parent 15bc28f commit 2dd5954
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ import MathProgBase
export solve!

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

m = MathProgBase.model(s)
# 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)
c, A, b, cones, var_to_ranges, vartypes = conic_problem(problem)
set_default_solver(old_solver)

if problem.head == :maximize
c = -c
end
Expand Down Expand Up @@ -60,9 +67,6 @@ function solve!(problem::Problem,
end
end

solve!(problem::Problem, m::MathProgBase.AbstractMathProgSolver) =
solve!(problem, MathProgBase.model(m))

function populate_variables!(problem::Problem, var_to_ranges::Dict{Uint64, (Int64, Int64)})
x = problem.solution.primal
for (id, (start_index, end_index)) in var_to_ranges
Expand Down

0 comments on commit 2dd5954

Please sign in to comment.