@@ -621,7 +621,44 @@ function test_vector_of_variables_objective()
621621 MOI. set (model, MOI. ObjectiveFunction {typeof(f)} (), f)
622622 MOI. add_constraint (model, sum (1.0 * xi for xi in x), MOI. GreaterThan (1.0 ))
623623 MOI. optimize! (model)
624- MOI. get (model, MOI. TerminationStatus ()) == MOI. OPTIMAL
624+ @test MOI. get (model, MOI. TerminationStatus ()) == MOI. OPTIMAL
625+ return
626+ end
627+
628+ function test_issue_105 ()
629+ cost = [100.0 , 120.0 , 150.0 , 110.0 , 200.0 , 170.0 ]
630+ time = [8.0 , 3.0 , 4.0 , 2.0 , 5.0 , 4.0 ]
631+ capacity = [10.0 , 8.0 ]
632+ demand = [5.0 , 8.0 , 5.0 ]
633+ m, n = 2 , 3
634+ model = MOI. instantiate (; with_bridge_type = Float64) do
635+ return MOA. Optimizer (HiGHS. Optimizer)
636+ end
637+ MOI. set (model, MOA. Algorithm (), MOA. TambyVanderpooten ())
638+ MOI. set (model, MOI. Silent (), true )
639+ x = MOI. add_variables (model, m * n)
640+ MOI. add_constraint .(model, x, MOI. GreaterThan (0.0 ))
641+ MOI. add_constraint .(model, x, MOI. Integer ())
642+ X = reshape (x, m, n)
643+ for i in 1 : m
644+ f_i = MOI. ScalarAffineFunction (MOI. ScalarAffineTerm .(1.0 , X[i, :]), 0.0 )
645+ MOI. add_constraint (model, f_i, MOI. LessThan (capacity[i]))
646+ end
647+ for j in 1 : n
648+ f_j = MOI. ScalarAffineFunction (MOI. ScalarAffineTerm .(1.0 , X[:, j]), 0.0 )
649+ MOI. add_constraint (model, f_j, MOI. EqualTo (demand[j]))
650+ end
651+ f = MOI. Utilities. operate (
652+ vcat,
653+ Float64,
654+ MOI. ScalarAffineFunction (MOI. ScalarAffineTerm .(cost, x), 0.0 ),
655+ MOI. ScalarAffineFunction (MOI. ScalarAffineTerm .(time, x), 0.0 ),
656+ MOI. ScalarAffineFunction (MOI. ScalarAffineTerm .(1.0 , x), 0.0 ),
657+ )
658+ MOI. set (model, MOI. ObjectiveSense (), MOI. MIN_SENSE)
659+ MOI. set (model, MOI. ObjectiveFunction {typeof(f)} (), f)
660+ MOI. optimize! (model)
661+ @test MOI. get (model, MOI. ResultCount ()) == 6
625662 return
626663end
627664
0 commit comments