# Copyright (c) Dietmar Wolz. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory. import math from fcmaes.astro import MessFull, Messenger, Gtoc1, Cassini1, Cassini2, Rosetta, Tandem, Sagas from fcmaes.optimizer import logger, de_cma, da_cma, Cma_cpp, De_cpp, Da_cpp, Dual_annealing, Differential_evolution from fcmaes.retry import minimize problems = [Cassini1(), Cassini2(), Rosetta(), Tandem(5), Messenger(), Gtoc1(), MessFull(), Sagas()] max_evals = 50000 algos = [de_cma(max_evals), da_cma(max_evals), Cma_cpp(max_evals), De_cpp(max_evals), Da_cpp(max_evals), Dual_annealing(max_evals), Differential_evolution(max_evals)] def test_all(num_retries = 10000, num = 10): for problem in problems: for algo in algos: _test_optimizer(algo, problem, num_retries, num) def _test_optimizer(opt, problem, num_retries = 32, num = 10): log = logger() log.info(problem.name + ' ' + opt.name) for _ in range(num): ret = minimize(problem.fun, problem.bounds, math.inf, num_retries, log, optimizer=opt) def main(): test_all()
Tandem(5), Messenger(), Gtoc1(), MessFull(), Sagas(), Cassini1minlp() ] algos = [ de2_cma(min_evals), de_cma(min_evals), da_cma(min_evals), Cma_cpp(min_evals), De_cpp(min_evals), Hh_cpp(min_evals), Da_cpp(min_evals), Dual_annealing(min_evals), Differential_evolution(min_evals) ] def messengerFullLoop(opt, num, max_time=1200, log=logger()): problem = MessFull() minimizers = None # remote actors created by minimize will be reused log.info(problem.name + ' ' + opt.name) for i in range(num): ret, minimizers = minimize(problem.fun, problem.bounds, max_nodes, None, num_retries=20000, value_limit=12.0,
Cassini1minlp() ] max_evals = 50000 algos = [ de_cma(max_evals), de2_cma(max_evals), da_cma(max_evals), Cma_cpp(max_evals), De_cpp(max_evals), Hh_cpp(max_evals), Da_cpp(max_evals), Bite_cpp(max_evals), Csma_cpp(max_evals), Dual_annealing(max_evals), Differential_evolution(max_evals) ] def test_all(num_retries=10000, num=1): for problem in problems: for algo in algos: _test_optimizer(algo, problem, num_retries, num) def _test_optimizer(opt, problem, num_retries=32, num=1): log = logger() log.info(problem.name + ' ' + opt.name) for _ in range(num): minimize(problem.fun,