File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -97,8 +97,7 @@ function get_bipartite_incidence_graph(
97
97
# to standardize at some point. E.g. a get_scalar_constraints function.
98
98
constraints = JuMP. all_constraints (
99
99
model,
100
- # TODO : Should this be an optional argument to this function?
101
- include_variable_in_set_constraints= false ,
100
+ include_variable_in_set_constraints = true ,
102
101
)
103
102
else
104
103
constraints = get_equality_constraints (model)
Original file line number Diff line number Diff line change @@ -93,9 +93,25 @@ function test_get_incidence_graph_badconstraint()
93
93
return
94
94
end
95
95
96
+ function test_include_bound_as_inequality ()
97
+ m = jmp. Model ()
98
+ @jmp . variable (m, 0 <= x[1 : 2 ])
99
+ @jmp . constraint (m, eq1, x[1 ] + 2 * x[2 ] == 1 )
100
+ graph, con_node_map, var_node_map = get_bipartite_incidence_graph (
101
+ m, include_inequality = true
102
+ )
103
+ A, B, E = graph
104
+ @test length (A) == 3
105
+ @test length (B) == 2
106
+ @test length (E) == 4
107
+ pred_con_set = Set ([eq1, jmp. LowerBoundRef (x[1 ]), jmp. LowerBoundRef (x[2 ])])
108
+ @test pred_con_set == keys (con_node_map)
109
+ end
110
+
96
111
function runtests ()
97
112
test_get_incidence_graph ()
98
113
test_get_incidence_graph_badconstraint ()
114
+ test_include_bound_as_inequality ()
99
115
return
100
116
end
101
117
Original file line number Diff line number Diff line change @@ -238,6 +238,19 @@ function test_overconstrained_due_to_fixed_variable()
238
238
@test length (con_dmp. unmatched) == 1
239
239
end
240
240
241
+ function test_overconstrained_due_to_including_bound ()
242
+ m = JuMP. Model ()
243
+ @JuMP . variable (m, x)
244
+ @JuMP . variable (m, 0.01 <= y)
245
+ @JuMP . constraint (m, 2 * x + y == 1 )
246
+ @JuMP . NLconstraint (m, x == sqrt (y))
247
+ igraph = ji. IncidenceGraphInterface (m, include_inequality = true )
248
+ con_dmp, var_dmp = ji. dulmage_mendelsohn (igraph)
249
+ @test length (var_dmp. overconstrained) == 2
250
+ @test length (con_dmp. overconstrained) == 2
251
+ @test length (con_dmp. unmatched) == 1
252
+ end
253
+
241
254
function runtests ()
242
255
test_construct_interface ()
243
256
test_construct_interface_rectangular ()
@@ -248,6 +261,7 @@ function runtests()
248
261
test_maximum_matching ()
249
262
test_dulmage_mendelsohn ()
250
263
test_overconstrained_due_to_fixed_variable ()
264
+ test_overconstrained_due_to_including_bound ()
251
265
end
252
266
253
267
end
You can’t perform that action at this time.
0 commit comments