Ejemplo n.º 1
0
    def test_bukin6_bound_fail(self):
        """Test bukin6 bound exception"""
        x = - np.random.uniform(low=15.001,high=100,size=(3,2))
        x_ =  np.random.uniform(low=-5.001,high=-3.001,size=(3,2))
        x_1 =  np.random.uniform(low=-3.001,high=-100,size=(3,2))

        with self.assertRaises(ValueError):
            fx.bukin6_func(x)
        with self.assertRaises(ValueError):
            fx.bukin6_func(x_)
        with self.assertRaises(ValueError):
            fx.bukin6_func(x_1)
Ejemplo n.º 2
0
def test_bukin6_output(common_minima2):
    """Test bukin function output."""
    assert np.isclose(fx.bukin6_func([-10, 1] * common_minima2),
                      np.zeros(3)).all()
Ejemplo n.º 3
0
def test_bukin6_bound_fail(x):
    """Test bukin6 bound exception"""
    with pytest.raises(ValueError):
        fx.bukin6_func(x)
Ejemplo n.º 4
0
def test_bukin6_dim_fail(outdim):
    """Test bukin6 dim exception"""
    with pytest.raises(IndexError):
        fx.bukin6_func(outdim)
Ejemplo n.º 5
0
 def test_bukin6_output_size(self):
     """Test bukin6 output size."""
     self.assertEqual(fx.bukin6_func([-10,0] * self.input2).shape, self.target_size)
Ejemplo n.º 6
0
 def test_bukin6_output(self):
     """Test bukin function output."""
     assert np.isclose(fx.bukin6_func([-10, 1] * self.input2),
         self.target).all()
Ejemplo n.º 7
0
 def test_bukin6_dim_fail(self):
     """Test bukin6 dim exception"""
     with self.assertRaises(IndexError):
         fx.bukin6_func(self.bad_input)
Ejemplo n.º 8
0
def test_bukin6_output_size(common_minima2, targetdim):
    """Test bukin6 output size."""
    assert fx.bukin6_func([-10, 0] * common_minima2).shape == targetdim