Skip to content

Commit

Permalink
Moved to separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
avinashresearch1 committed Oct 11, 2022
1 parent 5dbfc8e commit 9e7070c
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions Colloquium_2/branch_bound_P_7_9.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using JuMP
using GLPK
using OrderedCollections

m = JuMP.Model()

@variables(m, begin
0 <= x
0 <= y1 <= 1
0 <= y2 <= 1
0 <= y3 <= 1
end)


# RMILP
@constraints(m, begin
x + 3y1 + 2y2 + y3 0
5y1 8y2 3y3 9
end)

@objective(m, Min, x + y1 + 3y2 + 2y3)

print(m)
set_optimizer(m, GLPK.Optimizer)
# Solving the optimization problem:

# Simple post-processing
function run_node(m)
JuMP.optimize!(m)
println(solution_summary(m))
vars = [x, y1, y2, y3]
return soln_dict = OrderedDict(var => value(var) for var in vars)
end

# RMILP - Root node
run_node(m)

# Add y1 = 0
fix(y1, 0; force = true)
run_node(m)

# Add y1 = 0 and y3 = 0
fix(y3, 0; force = true)
run_node(m)

# Add y1 = 0 and y3 = 1
fix(y3, 1; force = true)
run_node(m)

# Add y1 = 0, y3 = 1, y2 = 0
fix(y2, 0; force = true)
run_node(m)

# Add y1 = 0, y3 = 1, y2 = 1
fix(y2, 1; force = true)
run_node(m)

# Add y1 = 1
# Start from line 5 here to keep UBDs on y2
fix(y1, 1; force = true)
run_node(m)

# Add y1 = 1, y2 = 0
fix(y2, 0; force = true)
run_node(m)

# Add y1 = 1, y2 = 1
fix(y2, 1; force = true)
run_node(m)

0 comments on commit 9e7070c

Please sign in to comment.