@@ -260,6 +260,114 @@ function test_iis()
260260 @test length (ret[]. constraint) == 2
261261 @test ret[]. constraint[1 ] == c2
262262 @test ret[]. constraint[2 ] == c1
263+ #
264+ buf = IOBuffer ()
265+ ModelAnalyzer. summarize (
266+ buf,
267+ ModelAnalyzer. Infeasibility. IrreducibleInfeasibleSubset,
268+ )
269+ str = String (take! (buf))
270+ @test startswith (str, " # `IrreducibleInfeasibleSubset`" )
271+ ModelAnalyzer. summarize (
272+ buf,
273+ ModelAnalyzer. Infeasibility. IrreducibleInfeasibleSubset,
274+ verbose = false ,
275+ )
276+ str = String (take! (buf))
277+ @test str == " # IrreducibleInfeasibleSubset"
278+ #
279+ ModelAnalyzer. summarize (buf, ret[1 ], verbose = true )
280+ str = String (take! (buf))
281+ @test startswith (str, " Irreducible Infeasible Subset: " )
282+ @test contains (str, " , " )
283+ ModelAnalyzer. summarize (buf, ret[1 ], verbose = false )
284+ str = String (take! (buf))
285+ @test startswith (str, " IIS: " )
286+ @test contains (str, " , " )
287+
288+ buf = IOBuffer ()
289+ Base. show (buf, data)
290+ str = String (take! (buf))
291+ return
292+ end
293+
294+ function test_iis_multiple ()
295+ model = Model (HiGHS. Optimizer)
296+ set_silent (model)
297+ @variable (model, 0 <= x <= 10 )
298+ @variable (model, 0 <= y <= 20 )
299+ @constraint (model, c1, x + y <= 1 )
300+ @constraint (model, c3, x + y <= 1.5 )
301+ @constraint (model, c2, x + y >= 2 )
302+ @objective (model, Max, x + y)
303+ optimize! (model)
304+ data = ModelAnalyzer. analyze (ModelAnalyzer. Infeasibility. Analyzer (), model)
305+ list = ModelAnalyzer. list_of_issue_types (data)
306+ @test length (list) == 0
307+ data = ModelAnalyzer. analyze (
308+ ModelAnalyzer. Infeasibility. Analyzer (),
309+ model,
310+ optimizer = HiGHS. Optimizer,
311+ )
312+ list = ModelAnalyzer. list_of_issue_types (data)
313+ @test length (list) == 1
314+ ret = ModelAnalyzer. list_of_issues (data, list[1 ])
315+ @test length (ret) == 1
316+ @test length (ret[]. constraint) == 2
317+ @test c2 in Set ([ret[]. constraint[1 ], ret[]. constraint[2 ]])
318+ @test Set ([ret[]. constraint[1 ], ret[]. constraint[2 ]]) ⊆ Set ([c3, c2, c1])
319+ return
320+ end
321+
322+ function test_iis_interval_right ()
323+ model = Model (HiGHS. Optimizer)
324+ set_silent (model)
325+ @variable (model, 0 <= x <= 10 )
326+ @variable (model, 0 <= y <= 20 )
327+ @constraint (model, c1, 0 <= x + y <= 1 )
328+ @constraint (model, c2, x + y >= 2 )
329+ @objective (model, Max, x + y)
330+ optimize! (model)
331+ data = ModelAnalyzer. analyze (ModelAnalyzer. Infeasibility. Analyzer (), model)
332+ list = ModelAnalyzer. list_of_issue_types (data)
333+ @test length (list) == 0
334+ data = ModelAnalyzer. analyze (
335+ ModelAnalyzer. Infeasibility. Analyzer (),
336+ model,
337+ optimizer = HiGHS. Optimizer,
338+ )
339+ list = ModelAnalyzer. list_of_issue_types (data)
340+ @test length (list) == 1
341+ ret = ModelAnalyzer. list_of_issues (data, list[1 ])
342+ @test length (ret) == 1
343+ @test length (ret[]. constraint) == 2
344+ @test Set ([ret[]. constraint[1 ], ret[]. constraint[2 ]]) == Set ([c2, c1])
345+ return
346+ end
347+
348+ function test_iis_interval_left ()
349+ model = Model (HiGHS. Optimizer)
350+ set_silent (model)
351+ @variable (model, 0 <= x <= 10 )
352+ @variable (model, 0 <= y <= 20 )
353+ @constraint (model, c1, x + y <= 1 )
354+ @constraint (model, c2, 2 <= x + y <= 5 )
355+ @objective (model, Max, x + y)
356+ optimize! (model)
357+ data = ModelAnalyzer. analyze (ModelAnalyzer. Infeasibility. Analyzer (), model)
358+ list = ModelAnalyzer. list_of_issue_types (data)
359+ @test length (list) == 0
360+ data = ModelAnalyzer. analyze (
361+ ModelAnalyzer. Infeasibility. Analyzer (),
362+ model,
363+ optimizer = HiGHS. Optimizer,
364+ )
365+ list = ModelAnalyzer. list_of_issue_types (data)
366+ @test length (list) == 1
367+ ret = ModelAnalyzer. list_of_issues (data, list[1 ])
368+ @test length (ret) == 1
369+ @test length (ret[]. constraint) == 2
370+ @test Set ([ret[]. constraint[1 ], ret[]. constraint[2 ]]) == Set ([c2, c1])
263371 return
264372end
265373
0 commit comments