コード例 #1
0
def messengerFullLoop():
    while True:
        problem = MessFull()
        logger().info(problem.name + ' de + cmaes c++')
        ret = minimize(problem.fun,
                       bounds=problem.bounds,
                       num_retries=60000,
                       value_limit=10.0,
                       logger=logger())
コード例 #2
0
def messengerFullLoop():
    while True:
        problem = MessFull()
        logger().info(problem.name + ' de + cmaes c++')
        minimize(problem.fun,
                 bounds=problem.bounds,
                 num_retries=50000,
                 value_limit=12.0,
                 logger=logger(),
                 optimizer=de_cma(1500))
コード例 #3
0
def test_coordinated_retry():
    numRuns = 10
    min_evals = 1500
    algo = de_cma_pyg(min_evals)
    #algo = pyg_de_cma(min_evals)
    #algo = de_pyg_cma(min_evals)
    fac = 1.005
    _test_optimizer(algo,
                    Gtoc1(),
                    num_retries=10000,
                    num=numRuns,
                    value_limit=-300000.0,
                    stop_val=-1581950 / fac)
    _test_optimizer(algo,
                    Cassini1(),
                    num_retries=4000,
                    num=numRuns,
                    value_limit=20.0,
                    stop_val=4.9307 * fac)
    _test_optimizer(algo,
                    Cassini2(),
                    num_retries=6000,
                    num=numRuns,
                    value_limit=20.0,
                    stop_val=8.383 * fac)
    _test_optimizer(algo,
                    Messenger(),
                    num_retries=8000,
                    num=numRuns,
                    value_limit=20.0,
                    stop_val=8.63 * fac)
    _test_optimizer(algo,
                    Rosetta(),
                    num_retries=4000,
                    num=numRuns,
                    value_limit=20.0,
                    stop_val=1.3433 * fac)
    _test_optimizer(algo,
                    Sagas(),
                    num_retries=4000,
                    num=numRuns,
                    value_limit=100.0,
                    stop_val=18.187 * fac)
    _test_optimizer(algo,
                    Tandem(5),
                    num_retries=20000,
                    num=numRuns,
                    value_limit=-300.0,
                    stop_val=-1500.6 / fac)
    _test_optimizer(algo,
                    MessFull(),
                    num_retries=50000,
                    num=numRuns,
                    value_limit=12.0,
                    stop_val=1.959 * fac)
コード例 #4
0
def messengerFullLoop(opt, num=1, log=logger()):
    for i in range(num):
        problem = MessFull()
        log.info(problem.name + ' ' + opt.name)
        name = str(i + 1) + ' ' + problem.name if num > 1 else problem.name
        advretry.minimize_plot(name,
                               opt,
                               problem.fun,
                               problem.bounds,
                               12.0,
                               12.0,
                               50000,
                               logger=log)
コード例 #5
0
def main():
    numRuns = 100
    min_evals = 1500
    _test_optimizer(de_cma(min_evals),
                    Gtoc1(),
                    num_retries=10000,
                    num=numRuns,
                    value_limit=-300000.0,
                    stop_val=-1581949)
    _test_optimizer(de_cma(min_evals),
                    Cassini1(),
                    num_retries=4000,
                    num=numRuns,
                    value_limit=20.0,
                    stop_val=4.93075)
    _test_optimizer(de_cma(min_evals),
                    Cassini2(),
                    num_retries=6000,
                    num=numRuns,
                    value_limit=20.0,
                    stop_val=8.38305)
    _test_optimizer(de_cma(min_evals),
                    Messenger(),
                    num_retries=8000,
                    num=numRuns,
                    value_limit=20.0,
                    stop_val=8.62995)
    _test_optimizer(de_cma(min_evals),
                    Rosetta(),
                    num_retries=4000,
                    num=numRuns,
                    value_limit=20.0,
                    stop_val=1.34335)
    _test_optimizer(de_cma(min_evals),
                    Sagas(),
                    num_retries=4000,
                    num=numRuns,
                    value_limit=100.0,
                    stop_val=18.188)
    _test_optimizer(de_cma(min_evals),
                    Tandem(5),
                    num_retries=20000,
                    num=numRuns,
                    value_limit=-300.0,
                    stop_val=-1500)
    _test_optimizer(de_cma(min_evals),
                    MessFull(),
                    num_retries=50000,
                    num=numRuns,
                    value_limit=12.0,
                    stop_val=1.960)
コード例 #6
0
def test_archipelago():
    max_evals = 500000
    popsize = 32
    gen = int(max_evals / popsize + 1)
    algo = pg.algorithm(pg.de1220(gen=gen))
    fac = 1.005
    _test_archipelago(algo, Cassini1(), num=400, stop_val=4.9307 * fac)
    _test_archipelago(algo, Cassini2(), num=600, stop_val=8.383 * fac)
    _test_archipelago(algo, Gtoc1(), num=1000, stop_val=-1581950 / fac)
    _test_archipelago(algo, Messenger(), num=800, stop_val=8.63 * fac)
    _test_archipelago(algo, Rosetta(), num=400, stop_val=1.3433 * fac)
    _test_archipelago(algo, Sagas(), num=400, stop_val=18.187 * fac)
    _test_archipelago(algo, Tandem(5), num=2000, stop_val=-1500.6 / fac)
    _test_archipelago(algo, MessFull(), num=5000, stop_val=1.959 * fac)
コード例 #7
0
# 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()