Exemplo n.º 1
0
 def test_base_bound_infeasible(self):
     node = BaseNode(infeasible.lp, infeasible.integerIndices)
     node._base_bound()
     # infeasible problems should come back as neither lp nor mip feasible
     self.assertFalse(node.lp_feasible)
     self.assertFalse(node.mip_feasible)
     self.assertFalse(node.unbounded)
Exemplo n.º 2
0
 def test_base_bound_integer(self):
     node = BaseNode(no_branch.lp, no_branch.integerIndices)
     node._base_bound()
     self.assertTrue(node.objective_value == -2)
     self.assertTrue(all(node.solution == [1, 1, 0]))
     # integer solutions should come back as both lp and mip feasible
     self.assertTrue(node.lp_feasible)
     self.assertTrue(node.mip_feasible)
     self.assertFalse(node.unbounded)
Exemplo n.º 3
0
 def test_base_bound_infeasible(self):
     node = BaseNode(infeasible.lp, infeasible.integerIndices)
     node._base_bound()
     # infeasible problems should come back as neither lp nor mip feasible
     self.assertFalse(node.lp_feasible)
     self.assertFalse(node.mip_feasible)
     self.assertFalse(node.unbounded)
     self.assertTrue(node.solution is None)
     self.assertTrue(node.objective_value == float('inf'))
Exemplo n.º 4
0
 def test_base_bound_fractional(self):
     node = BaseNode(small_branch.lp, small_branch.integerIndices)
     node._base_bound()
     self.assertTrue(node.objective_value == -2.75)
     self.assertTrue(all(node.solution == [0, 1.25, 1.5]))
     # fractional solutions should come back as lp but not mip feasible
     self.assertTrue(node.lp_feasible)
     self.assertFalse(node.mip_feasible)
     self.assertFalse(node.unbounded)
Exemplo n.º 5
0
    def test_base_bound_unbounded(self):
        node = BaseNode(unbounded.lp, unbounded.integerIndices)
        node._base_bound()

        self.assertTrue(node.lp_feasible)
        self.assertTrue(node.unbounded)