예제 #1
0
 def test_aug_branin(self):
     self.assertEqual(aug_branin.name, "Aug_Branin")
     self.assertAlmostEqual(aug_branin(1, 2, 1), 21.62763539206238)
     self.assertAlmostEqual(aug_branin(x1=1, x2=2, x3=1), 21.62763539206238)
     self.assertAlmostEqual(aug_branin(np.array([1, 2, 1])), 21.62763539206238)
     self.assertAlmostEqual(
         aug_branin(np.array([[1, 2, 1], [1, 2, 1]]))[0], 21.62763539206238
     )
     self.assertAlmostEqual(aug_branin.minimums[0][0], -np.pi)
     self.assertAlmostEqual(aug_branin.fmin, branin.fmin)
     self.assertAlmostEqual(aug_branin.fmax, branin.fmax)
     self.assertEqual(aug_branin.domain[2], (0, 1))
     self.assertEqual(aug_branin.domain[0], (-5, 10))
     self.assertEqual(aug_branin.required_dimensionality, 3)
     with self.assertRaisesRegex(NotImplementedError, "Aug_Branin does not specify"):
         aug_branin.maximums
     with self.assertRaisesRegex(ValueError, "Synthetic function call"):
         aug_branin(np.array([[[1, 3, 1]]]))
예제 #2
0
파일: branin.py 프로젝트: facebook/Ax
 def f(self, x: np.ndarray) -> float:
     return checked_cast(float, aug_branin(x))