def test_range(self): self.assertTrue( np.array_equal( full_array(self.Upper, self.D) - full_array(self.Lower, self.D), self.task.range)) self.assertTrue( np.array_equal( full_array(self.Upper, self.D) - full_array(self.Lower, self.D), self.task.range))
def __init__(self, dimension=1, lower=None, upper=None, *args, **kwargs): r"""Initialize Problem. Args: dimension (Optional[int]): Dimension of the problem. lower (Optional[Union[float, Iterable[float]]]): Lower bounds of the problem. upper (Optional[Union[float, Iterable[float]]]): Upper bounds of the problem. """ self.dimension = dimension self.lower = full_array(lower, dimension) self.upper = full_array(upper, dimension)
def test_upper(self): self.assertTrue( np.array_equal(full_array(self.Upper, self.D), self.task.upper)) self.assertTrue( np.array_equal(full_array(self.Upper, self.D), self.task.upper))
def test_lower(self): self.assertTrue( np.array_equal(full_array(self.Lower, self.D), self.task.lower)) self.assertTrue( np.array_equal(full_array(self.Lower, self.D), self.task.lower))