Ejemplo n.º 1
0
    def test_matyas_bound_fail(self):
        """Test matyas bound exception"""
        x = - np.random.uniform(low=10.001,high=100,size=(3,2))
        x_ = np.random.uniform(low=10.001,high=100,size=(3,2))

        with self.assertRaises(ValueError):
            fx.matyas_func(x)
        with self.assertRaises(ValueError):
            fx.matyas_func(x_)
Ejemplo n.º 2
0
def test_bukin6_output(common_minima):
    """Test bukin function output."""
    assert np.isclose(fx.matyas_func(common_minima), np.zeros(3)).all()
Ejemplo n.º 3
0
def test_matyas_bound_fail(outbound):
    """Test matyas bound exception"""
    with pytest.raises(ValueError):
        x = outbound(b["matyas"].low, b["matyas"].high, size=(3, 2))
        fx.matyas_func(x)
Ejemplo n.º 4
0
def test_matyas_dim_fail(outdim):
    """Test matyas dim exception"""
    with pytest.raises(IndexError):
        fx.matyas_func(outdim)
Ejemplo n.º 5
0
 def test_bukin6_output(self):
     """Test bukin function output."""
     assert np.isclose(fx.matyas_func(self.input),self.target).all()
Ejemplo n.º 6
0
 def test_matyas_dim_fail(self):
     """Test matyas dim exception"""
     with self.assertRaises(IndexError):
         fx.matyas_func(self.bad_input)