From ba3d226d468c8a4feb8b171944a33daa5d0a5732 Mon Sep 17 00:00:00 2001 From: Miles Lubin Date: Sat, 28 Nov 2015 20:46:31 -0500 Subject: [PATCH] updates for MPB 0.4 --- src/problems.jl | 6 +++--- src/solution.jl | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/problems.jl b/src/problems.jl index 8ea001b28..b9a276c7c 100644 --- a/src/problems.jl +++ b/src/problems.jl @@ -24,18 +24,18 @@ type Problem constraints::Array{Constraint} status::Symbol optval::Float64OrNothing - model::MathProgBase.AbstractMathProgModel + model::MathProgBase.AbstractConicModel solution::Solution function Problem(head::Symbol, objective::AbstractExpr, - model::MathProgBase.AbstractMathProgModel, constraints::Array=Constraint[]) + model::MathProgBase.AbstractConicModel, constraints::Array=Constraint[]) return new(head, objective, constraints, "not yet solved", nothing, model) end end # constructor if model is not specified function Problem(head::Symbol, objective::AbstractExpr, constraints::Array=Constraint[], solver::MathProgBase.AbstractMathProgSolver = get_default_solver()) - Problem(head, objective, MathProgBase.model(solver), constraints) + Problem(head, objective, MathProgBase.ConicModel(solver), constraints) end # If the problem constructed is of the form Ax=b where A is m x n diff --git a/src/solution.jl b/src/solution.jl index 28cb8f873..fcd60ba93 100644 --- a/src/solution.jl +++ b/src/solution.jl @@ -9,7 +9,7 @@ function solve!(problem::Problem, s::MathProgBase.AbstractMathProgSolver; kwargs...) # TODO: warn about wiping out old model if warmstart=true? - problem.model = MathProgBase.model(s) + problem.model = MathProgBase.ConicModel(s) return solve!(problem; kwargs...) end @@ -40,7 +40,7 @@ function solve!(problem::Problem; end -function set_warmstart!(m::MathProgBase.AbstractMathProgModel, +function set_warmstart!(m::MathProgBase.AbstractConicModel, problem::Problem, n::Int, # length of primal (conic) solution var_to_ranges) @@ -74,11 +74,11 @@ function set_warmstart!(m::MathProgBase.AbstractMathProgModel, m end -function load_problem!(m::MathProgBase.AbstractMathProgModel, c, A, b, cones, vartypes) +function load_problem!(m::MathProgBase.AbstractConicModel, c, A, b, cones, vartypes) # no conic constraints on variables var_cones = fill((:Free, 1:size(A, 2)),1) # TODO: Get rid of full once c and b are not sparse - MathProgBase.loadconicproblem!(m, vec(full(c)), A, vec(full(b)), cones, var_cones) + MathProgBase.loadproblem!(m, vec(full(c)), A, vec(full(b)), cones, var_cones) # add integer and binary constraints on variables if !all(Bool[t==:Cont for t in vartypes]) @@ -91,12 +91,12 @@ function load_problem!(m::MathProgBase.AbstractMathProgModel, c, A, b, cones, va m end -function populate_solution!(m::MathProgBase.AbstractMathProgModel, +function populate_solution!(m::MathProgBase.AbstractConicModel, problem::Problem, var_to_ranges, conic_constraints) try - dual = MathProgBase.getconicdual(m) + dual = MathProgBase.getdual(m) problem.solution = Solution(MathProgBase.getsolution(m), dual, MathProgBase.status(m), MathProgBase.getobjval(m)) catch