def test_include_variable_with_bounds(self): lb = -DM(range(1, 4)) ub = DM(range(5, 8)) aop = AbstractOptimizationProblem() x = MX.sym('x', 3) aop.include_variable(x, lb=lb, ub=ub) self.assertTrue(is_equal(aop.x_lb, lb)) self.assertTrue(is_equal(aop.x_ub, ub))
def test_include_variable_twice(self): # Test to avoid override aop = AbstractOptimizationProblem() x = MX.sym('x', 3) y = MX.sym('y', 5) aop.include_variable(x) aop.include_variable(y) self.assertTrue(is_equal(aop.x[:x.numel()], x)) self.assertTrue(is_equal(aop.x[x.numel():], y))
def test_include_variable(self): aop = AbstractOptimizationProblem() x = MX.sym('x', 3) aop.include_variable(x) self.assertTrue(is_equal(aop.x, x))