def test_parameter_settings(self): p = parameter.generate([self.const])[0] self.assertEqual(p['random'], 10, 'Random value must always be 10') self.assertEqual(p['optguess'], 10, 'Optguess value must always be 10') self.assertEqual(p['maxbound'], 10, 'maxbound value must always be 10') self.assertEqual(p['minbound'], 10, 'minbound value must always be 10') self.assertEqual(p['step'], 0, 'step value must always be 0')
def test_find_constant_parameters(self): flex = parameter.Uniform('flexible', 0, 1) p = parameter.generate([flex, self.const]) constant_parameters = parameter.find_constant_parameters(p) self.assertFalse(constant_parameters[0], 'Flexible parameter detected as constant') self.assertTrue(constant_parameters[1], 'Constant parameter not detected')
def parameters(self): return parameter.generate( [parameter.Uniform(name, -1, 1) for name in 'cd'])