Esempio n. 1
0
 def test_gutmann_branin_noisy_with_init(self):
     """Check solution of noisy braning with Gutmann, solver."""
     bb = ti.TestNoisyBlackBox('branin', 0.1, 0.01)
     optimum = bb._function.optimum_value
     for seed in self.rand_seeds:
         print()
         print('Solving branin with random seed ' + '{:d}'.format(seed))
         settings = RbfSettings(algorithm='Gutmann',
                                global_search_method='solver',
                                target_objval=optimum,
                                eps_opt=self.eps_opt,
                                max_iterations=200,
                                max_evaluations=300,
                                fast_objfun_rel_error=0.1,
                                fast_objfun_abs_error=0.01,
                                rand_seed=seed)
         init_node_pos = [[0, 0], [-2, 2], [5, 10]]
         init_node_val = [bb._function.evaluate(x) for x in init_node_pos]
         alg = ra.OptAlgorithm(settings, bb, init_node_pos, init_node_val)
         res = alg.optimize()
         msg = ('Could not solve noisy branin with init and ' +
                'Gutmann\'s algorithm')
         target = optimum + (abs(optimum) * self.eps_opt if abs(optimum) >
                             settings.eps_zero else self.eps_opt)
         self.assertLessEqual(res[0], target, msg=msg)
Esempio n. 2
0
 def test_gutmann_st_miqp3_noisy(self):
     """Check solution of noisy st_miqp3 with Gutmann, genetic."""
     bb = ti.TestNoisyBlackBox('st_miqp3', 0.1, 0.01)
     optimum = bb._function.optimum_value
     for seed in self.rand_seeds:
         print()
         print('Solving st_miqp3 with random seed ' + '{:d}'.format(seed))
         settings = RbfSettings(algorithm='Gutmann',
                                global_search_method='genetic',
                                target_objval=optimum,
                                eps_opt=self.eps_opt,
                                max_iterations=200,
                                max_evaluations=300,
                                fast_objfun_rel_error=0.1,
                                fast_objfun_abs_error=0.01,
                                rand_seed=seed)
         alg = ra.OptAlgorithm(settings, bb)
         res = alg.optimize()
         msg = 'Could not solve st_miqp3 with Gutmann\'s algorithm'
         target = optimum + (abs(optimum) * self.eps_opt if abs(optimum) >
                             settings.eps_zero else self.eps_opt)
         self.assertLessEqual(res[0], target, msg=msg)
Esempio n. 3
0
 def test_msrsm_parallel_prob03_noisy(self):
     """Check solution of noisy prob03 with MSRSM, sampling."""
     bb = ti.TestNoisyBlackBox('prob03', 0.1, 0.01)
     optimum = bb._function.optimum_value
     for seed in self.rand_seeds:
         print()
         print('Solving prob03 with random seed ' + '{:d}'.format(seed))
         settings = RbfSettings(algorithm='MSRSM',
                                global_search_method='sampling',
                                target_objval=optimum,
                                eps_opt=self.eps_opt,
                                max_iterations=200,
                                max_evaluations=300,
                                num_cpus=4,
                                fast_objfun_rel_error=0.1,
                                fast_objfun_abs_error=0.01,
                                rand_seed=seed)
         alg = ra.OptAlgorithm(settings, bb)
         res = alg.optimize()
         msg = 'Could not solve prob03 with MSRSM algorithm'
         target = optimum + (abs(optimum) * self.eps_opt if abs(optimum) >
                             settings.eps_zero else self.eps_opt)
         self.assertLessEqual(res[0], target, msg=msg)