Skip to content

Commit

Permalink
WIP: adding cplex annotations to be used for bender decomposition (#125)
Browse files Browse the repository at this point in the history
* added annotations to handle benders

* solver removed from CplexModel

* Removing cstrs decomposition (DW dec not supported)

* Keep annotations only
  • Loading branch information
IssamT authored and mlubin committed Apr 24, 2017
1 parent 0be7dbc commit 35f0c91
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/CplexSolverInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ function setvartype!(m::CplexMathProgModel, v::Vector{Symbol})
prob_type = get_prob_type(m.inner)
if target_int
if m.inner.has_sos # if it has sos we need to keep has_int==true and the MI(prob_type) version.
set_vartype!(m.inner, map(x->rev_var_type_map[x], v))
set_vartype!(m.inner, map(x->rev_var_type_map[x], v))
else
m.inner.has_int = false
if !(prob_type in [:LP,:QP,:QCP])
Expand Down
30 changes: 30 additions & 0 deletions src/cpx_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,36 @@ function set_branching_priority(model::Model, indices::Vector{Cint}, priority::V
return nothing
end


function newlongannotation(model::Model, name::String, defval::Clong)
stat = @cpx_ccall(newlongannotation, Cint, (
Ptr{Void},
Ptr{Void},
Ptr{Cchar},
Clong),
model.env.ptr, model.lp, name, defval)
stat == 0 || throw(CplexError(model.env, stat))

return nothing
end

function setlongannotations(model::Model, idx::Cint, objtype::Cint, cnt::Cint, indexArr::Array{Cint},
valArr::Array{Clong})
stat = @cpx_ccall(setlongannotations, Cint, (
Ptr{Void},
Ptr{Void},
Cint,
Cint,
Cint,
Ptr{Void},
Ptr{Void}),
model.env.ptr, model.lp, idx, objtype, cnt, indexArr, valArr)
stat == 0 || throw(CplexError(model.env, stat))
return nothing
end

export setlongannotations, newlongannotation

function get_objval(model::Model)
objval = Array(Cdouble, 1)
stat = @cpx_ccall(getobjval, Cint, (
Expand Down

0 comments on commit 35f0c91

Please sign in to comment.