예제 #1
0
 def test_aug_hartmann6(self):
     self.assertEqual(aug_hartmann6.name, "Aug_Hartmann6")
     self.assertAlmostEqual(aug_hartmann6(1, 2, 3, 4, 5, 6, 1), 0.0)
     self.assertAlmostEqual(
         aug_hartmann6(x1=1, x2=2, x3=3, x4=4, x5=5, x6=6, x7=1), 0.0
     )
     self.assertAlmostEqual(aug_hartmann6(np.array([1, 2, 3, 4, 5, 6, 1])), 0.0)
     self.assertAlmostEqual(
         aug_hartmann6(np.array([[1, 2, 3, 4, 5, 6, 1], [1, 2, 3, 4, 5, 6, 1]]))[0],
         0.0,
     )
     self.assertAlmostEqual(aug_hartmann6.minimums[0][0], 0.20169, places=5)
     self.assertAlmostEqual(aug_hartmann6.fmin, -3.32237, places=5)
     self.assertEqual(aug_hartmann6.fmax, 0.0)
     self.assertEqual(aug_hartmann6.domain[0], (0, 1))
     self.assertEqual(aug_hartmann6.required_dimensionality, 7)
     with self.assertRaisesRegex(
         NotImplementedError, "Aug_Hartmann6 does not specify"
     ):
         aug_hartmann6.maximums
예제 #2
0
파일: hartmann6.py 프로젝트: tangzhenyu/ax
 def f(self, x: np.ndarray) -> float:
     return checked_cast(float, aug_hartmann6(x))