Skip to content

Commit ddf9b44

Browse files
committed
modified tests
1 parent 50acafe commit ddf9b44

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

test/constraints/cuttingplanes.jl

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,13 @@ function test_solve_SEP()
5454
main_to_rBM_map = Dict(v => rBM_ref_map[v] for v in all_variables(model))
5555
JuMP.set_optimizer(SEP, method.optimizer)
5656
JuMP.set_optimizer(rBM, method.optimizer)
57+
JuMP.set_silent(rBM)
58+
JuMP.set_silent(SEP)
59+
JuMP.relax_integrality(rBM)
60+
JuMP.relax_integrality(SEP)
5761
JuMP.@objective(rBM, sense,
5862
DP._replace_variables_in_constraint(obj, main_to_rBM_map)
5963
)
60-
for m in [SEP, rBM]
61-
binary_vars = filter(is_binary, all_variables(m))
62-
for var in binary_vars
63-
unset_binary(var)
64-
set_lower_bound(var, 0.0)
65-
set_upper_bound(var, 1.0)
66-
end
67-
end
6864
rBM_to_SEP_map = Dict{var_type, var_type}()
6965
SEP_to_rBM_map = Dict{var_type, var_type}()
7066
for (var, rBM_var) in main_to_rBM_map
@@ -77,7 +73,9 @@ function test_solve_SEP()
7773
@test length(SEP_sol) == length(rBM_sol)
7874
@test SEP_sol[rBM_to_SEP_map[main_to_rBM_map[x]]] 4.0
7975

80-
@test_throws ErrorException DP._solve_SEP(SEP, rBM, rBM_sol, SEP_to_rBM_map, "not a dict")
76+
@test_throws ErrorException DP._solve_SEP(SEP, rBM, rBM_sol, SEP_to_rBM_map
77+
, "not a dict"
78+
)
8179
end
8280

8381
function test_cutting_planes()
@@ -100,17 +98,13 @@ function test_cutting_planes()
10098
main_to_rBM_map = Dict(v => rBM_ref_map[v] for v in all_variables(model))
10199
JuMP.set_optimizer(SEP, method.optimizer)
102100
JuMP.set_optimizer(rBM, method.optimizer)
101+
JuMP.set_silent(rBM)
102+
JuMP.set_silent(SEP)
103+
JuMP.relax_integrality(rBM)
104+
JuMP.relax_integrality(SEP)
103105
JuMP.@objective(rBM, sense,
104106
DP._replace_variables_in_constraint(obj, main_to_rBM_map)
105107
)
106-
for m in [SEP, rBM]
107-
binary_vars = filter(is_binary, all_variables(m))
108-
for var in binary_vars
109-
unset_binary(var)
110-
set_lower_bound(var, 0.0)
111-
set_upper_bound(var, 1.0)
112-
end
113-
end
114108
rBM_to_SEP_map = Dict{var_type, var_type}()
115109
SEP_to_rBM_map = Dict{var_type, var_type}()
116110
for (var, rBM_var) in main_to_rBM_map
@@ -128,7 +122,9 @@ function test_cutting_planes()
128122
@test rBM_sol[main_to_rBM_map[x]] 4.0
129123
@test SEP_sol[rBM_to_SEP_map[main_to_rBM_map[x]]] 4.0 atol=1e-3
130124

131-
@test_throws ErrorException DP._cutting_planes(model, rBM, main_to_rBM_map, main_to_SEP_map, rBM_sol, "not a dict")
125+
@test_throws ErrorException DP._cutting_planes(model, rBM, main_to_rBM_map,
126+
main_to_SEP_map, rBM_sol, "not a dict"
127+
)
132128
end
133129

134130
function test_reformulate_model()

0 commit comments

Comments
 (0)