Ejemplo n.º 1
0
    Ackley,
    Griewank,
    Sphere,
    HappyCat
)


"""Example demonstrating the use of NiaPy Runner."""


runner = Runner(
    D=40,
    nFES=100,
    nRuns=2,
    useAlgorithms=[
        GreyWolfOptimizer(),
        "FlowerPollinationAlgorithm",
        ParticleSwarmAlgorithm(),
        "HybridBatAlgorithm",
        "SimulatedAnnealing",
        "CuckooSearch"],
    useBenchmarks=[
        Ackley(),
        Griewank(),
        Sphere(),
        HappyCat(),
        "rastrigin"]
)

print(runner.run(verbose=True))
Ejemplo n.º 2
0
import sys

sys.path.append('../')
import pandas as pd
import time
import numpy as np
import runner
import Procesing
import Storage

from NiaPy.benchmarks import Ackley, Rastrigin, Rosenbrock, Griewank, Sphere, Whitley, Zakharov, Perm, Powell, Pinter

#input parameters
ArrayOfNP = [10, 20]  #,30,50,75,100
ArrayOfBenchmarks = [
    Ackley(), Rastrigin()
]  #,Rosenbrock(),Griewank(), Sphere(), Whitley(), Zakharov(), Perm(), Powell(), Pinter()
ArrayOfnFES = [10000]  #,20000,30000
ArrayOfD = [10]  #,20,30
NUM_RUNS = 1

resultFilePath = 'results.xlsx'
Processor = Procesing.Procesing()
Runner = runner.Runner()
Storage = Storage.Storage()

beginningTime = time.time()
with pd.ExcelWriter('results.xlsx') as writer:
    for Np in ArrayOfNP:
        for nFES in ArrayOfnFES:
            for D in ArrayOfD:
Ejemplo n.º 3
0
    print(algo, ': MFO Average of Bests over', epoch, 'run: ', average_mfo)
    print(algo, ': ABC Average of Bests over', epoch, 'run: ', average_abc)
    print(algo, ': PSO Average of Bests over', epoch, 'run: ', average_pso)
    print(algo, ': BA Average of Bests over', epoch, 'run: ', average_ba)
    print(algo, ': FA Average of Bests over', epoch, 'run: ', average_fa)
    print(algo, ': GA Average of Bests over', epoch, 'run: ', average_ga)

    return [
        average_de, average_mfo, average_abc, average_pso, average_ba,
        average_fa, average_ga
    ]


results = {}

bench = Ackley(Lower=-5, Upper=5)
# plot(bench, 'ackley.png')
de, mfo, abc, pso, ba, fa, ga = optimize(bench, 'Ackley')
results["ackley"] = {
    "de": de,
    "mfo": mfo,
    "abc": abc,
    "pso": pso,
    "ba": ba,
    "fa": fa,
    "ga": ga
}
bench = Alpine1(Lower=-10, Upper=10)
# plot(bench, 'alpine.png')
de, mfo, abc, pso, ba, fa, ga = optimize(bench, 'Alpine')
results["alpine"] = {
Ejemplo n.º 4
0
# encoding=utf8
# This is temporary fix to import module from parent folder
# It will be removed when package is published on PyPI
from NiaPy import Runner
from NiaPy.algorithms.basic import (GreyWolfOptimizer, ParticleSwarmAlgorithm)
from NiaPy.benchmarks import (Ackley, Griewank, Sphere, HappyCat)

import sys
sys.path.append('../')
# End of fix
"""Example demonstrating the use of NiaPy Runner."""

runner = Runner(
    D=40,
    nFES=100,
    nRuns=1,
    useAlgorithms=[
        GreyWolfOptimizer(), "FlowerPollinationAlgorithm",
        ParticleSwarmAlgorithm(), "HybridBatAlgorithm", "SimulatedAnnealing",
        "CuckooSearch"
    ],
    useBenchmarks=[Ackley(),
                   Griewank(),
                   Sphere(),
                   HappyCat(), "rastrigin"])

print(runner.run(verbose=True))