diff --git a/src/SolverInterface.jl b/src/SolverInterface.jl index 32f7f59..e3a492b 100644 --- a/src/SolverInterface.jl +++ b/src/SolverInterface.jl @@ -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 @@ -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 ## ======================== @@ -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 @@ -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) @@ -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 \ No newline at end of file +function status(m::DRealMathProgModel) m.status end diff --git a/src/construct.jl b/src/construct.jl index 8a419b0..a13352d 100644 --- a/src/construct.jl +++ b/src/construct.jl @@ -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