Exemplo n.º 1
0
    def test_cpp(self):
        'runs the c++ test() function for the glpk interface'

        start_op = LpInstance.total_optimizations()
        start_it = LpInstance.total_iterations()

        LpInstance.test()
        self.assertGreater(LpInstance.total_iterations() - start_it,
                           5)  # the test ran a few iterations of lp
        self.assertGreater(LpInstance.total_optimizations() - start_op,
                           1)  # the test ran a few lp
Exemplo n.º 2
0
    def test_boundaries_optimized(self):
        'test finding the boundaries in an optimized fashion'

        Star.init_plot_vecs(2, TestStar.plot_settings)

        hr = HyperRectangle([
            (0, 1),
            (0, 1),
        ])
        star = init_hr_to_star(make_settings(), hr, TestStar.loc)

        start_op = LpInstance.total_optimizations()

        verts = star.verts()

        num_op = LpInstance.total_optimizations() - start_op

        self.assertEqual(len(verts), 5)
        self.assertLess(num_op, 100)