Skip to content

Commit

Permalink
Merge pull request #23 from soonhokong/master
Browse files Browse the repository at this point in the history
keep up with the recent MathProgBase.jl API changes
  • Loading branch information
zenna committed Jun 6, 2016
2 parents bb7aba5 + 04bc633 commit e57b16f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions src/SolverInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import MathProgBase.SolverInterface: AbstractMathProgSolver, AbstractMathProgModel,
getsense, numvar, numconstr, getobjval, getobjbound, getsolution, getsolvetime,
setwarmstart!, loadnonlinearproblem!, optimize!, AbstractNLPEvaluator, status,
setwarmstart!, loadproblem!, optimize!, AbstractNLPEvaluator, status,
obj_expr

## Solver Objects
Expand Down Expand Up @@ -39,7 +39,7 @@ function DRealMathProgModel(precision::Float64)
DRealMathProgModel(ctx)
end

MathProgBase.SolverInterface.model(s::DRealSolver) = DRealMathProgModel(s.precision)
MathProgBase.SolverInterface.NonlinearModel(s::DRealSolver) = DRealMathProgModel(s.precision)

## Interface Implementation
## ========================
Expand Down Expand Up @@ -70,15 +70,15 @@ end
function setwarmstart!(m::AbstractMathProgModel, v) end

# @doc "Loads the nonlinear programming problem into the model `m`." ->
function loadnonlinearproblem!(m::DRealMathProgModel,
numVar::Integer,
numConstr::Integer,
x_l::Vector{Float64}, # variable lower bounds
x_u::Vector{Float64}, # variable upper bounds
g_lb, # constraint lower bounds
g_ub, # constraint upper bounds
sense::Symbol, # :Max or :Min
d::AbstractNLPEvaluator)
function loadproblem!(m::DRealMathProgModel,
numVar::Integer,
numConstr::Integer,
x_l::Vector{Float64}, # variable lower bounds
x_u::Vector{Float64}, # variable upper bounds
g_lb, # constraint lower bounds
g_ub, # constraint upper bounds
sense::Symbol, # :Max or :Min
d::AbstractNLPEvaluator)

(sense == :Min || sense == :Max) || error("Unrecognized sense $sense")
@assert length(x_l) == length(x_u) == numVar
Expand All @@ -87,7 +87,7 @@ function loadnonlinearproblem!(m::DRealMathProgModel,
@show x_l
@show x_u
vars = [Var(m.ctx, Float64, x_l[i], x_u[i]) for i = 1:numVar]

m.vars = vars
@show obj_expr(d)
# push_ctx!(m.ctx)
Expand All @@ -114,4 +114,4 @@ function optimize!(m::DRealMathProgModel)
end

# @doc "Status after solving. Possible values include :Optimal, :Infeasible, :Unbounded, :UserLimit"
function status(m::DRealMathProgModel) m.status end
function status(m::DRealMathProgModel) m.status end
4 changes: 2 additions & 2 deletions src/construct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ for (op,opensmt_func) in @compat Dict(:(&) => opensmt_mk_and, :(|) => opensmt_mk
end

# Implication
implies{T1<:Union(Bool, Ex{Bool}), T2<:Union(Bool, Ex{Bool})}(ctx::Context, x::T1, y::T2) =
implies{T1<:Union{Bool, Ex{Bool}}, T2<:Union{Bool, Ex{Bool}}}(ctx::Context, x::T1, y::T2) =
(|)(ctx, (!)(ctx,x), y)
implies{T1<:Union(Bool, Ex{Bool}), T2<:Union(Bool, Ex{Bool})}(x::T1, y::T2) =
implies{T1<:Union{Bool, Ex{Bool}}, T2<:Union{Bool, Ex{Bool}}}(x::T1, y::T2) =
implies(global_context(),x,y)
= implies

Expand Down

0 comments on commit e57b16f

Please sign in to comment.