Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benders algo start #127

Merged
merged 11 commits into from
Jun 26, 2019
4 changes: 2 additions & 2 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.4.1"

[[ColunaDemos]]
deps = ["BlockDecomposition", "JuMP"]
git-tree-sha1 = "dbe0cd028280a9cbe1a6d535c59ad8a897f6b696"
deps = ["BlockDecomposition", "DelimitedFiles", "JuMP"]
git-tree-sha1 = "5fc432e1d98b3c36c9bbd84d98241a18a2875612"
repo-rev = "master"
repo-url = "https://github.com/atoptima/ColunaDemos.jl.git"
uuid = "a54e61d4-7723-11e9-2469-af255fcaa246"
Expand Down
1 change: 1 addition & 0 deletions src/Coluna.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ include("algorithms/reformulationsolver.jl")

# Here include conquer strategies
include("strategies/conquer/simplebnp.jl")
include("strategies/conquer/simplebenders.jl")

# Here include divide strategies
include("strategies/divide/simplebranching.jl")
Expand Down
8 changes: 7 additions & 1 deletion src/MOIinterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function update_bounds_in_optimizer!(optimizer::MoiOptimizer,
end

function update_cost_in_optimizer!(optimizer::MoiOptimizer, v::Variable)
cost = get_cost(getcurdata(v))
cost = getcost(getcurdata(v))
moi_index = getindex(getmoirecord(v))
MOI.modify(
getinner(optimizer), MoiObjective(),
Expand Down Expand Up @@ -217,9 +217,15 @@ function fill_dual_result!(optimizer::MoiOptimizer,
for (id, constr) in constrs
moi_index = getindex(getmoirecord(constr))
val = MOI.get(inner, MOI.ConstraintDual(res_idx), moi_index)

if val > 0.000001 || val < - 0.000001 # todo use a tolerance
@logmsg LogLevel(-4) string("Constr ", getname(constr), " = ", val)
sol[id] = val
#if S == MinSense
# sol[id] = (getsense(constr) != Less ? val : - val)
#else
# sol[id] = (getsense(constr) != Greater ? val : - val)
#end
end
end
push!(result.dual_sols, DualSolution{S}(db, sol))
Expand Down
6 changes: 3 additions & 3 deletions src/MOIwrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function load_obj!(f::Formulation, src::MOI.ModelLike,
var = getvar(f, moi_uid_to_coluna_id[term.variable_index.value])
perene_data = getrecordeddata(var)
setcost!(perene_data, term.coefficient)
setcost!(f, var, term.coefficient)
setcurcost!(f, var, term.coefficient)
end
return
end
Expand Down Expand Up @@ -110,10 +110,10 @@ function create_origconstr!(f::Formulation,
else
bound = getrhs(set)
if getsense(set) in [Equal, Less]
set_ub!(perene_data, bound)
setub!(perene_data, bound)
setub!(f, var, getub(perene_data))
elseif getsense(set) == [Equal, Greater]
set_lb!(perene_data, bound)
setlb!(perene_data, bound)
setlb!(f, var, getlb(perene_data))
end
end
Expand Down
12 changes: 6 additions & 6 deletions src/algorithms/algorithm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ end
Applies the algorithm `AlgorithmType` on the `formulation` in a `node` with
`parameters`.
"""
function apply!(S::Type{<:AbstractAlgorithm}, form, node, strategy_rec,
function apply!(A::Type{<:AbstractAlgorithm}, form, node, strategy_rec,
params)
prepare!(form, node)
setalgorithm!(strategy_rec, S)
TO.@timeit _to string(S) begin
setalgorithm!(strategy_rec, A)
TO.@timeit _to string(A) begin
TO.@timeit _to "prepare" begin
prepare!(S, form, node, strategy_rec, params)
prepare!(A, form, node, strategy_rec, params)
end
TO.@timeit _to "run" begin
record = run!(S, form, node, strategy_rec, params)
record = run!(A, form, node, strategy_rec, params)
end
end
set_algorithm_record!(node, S, record)
set_algorithm_record!(node, A, record)
return record
end

Expand Down
Loading