Skip to content

CavalloneChen/firework-algorithm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Firework Algorithm

Introduction

Firework algorithm (FWA) is a novel derivation-free optimization algorithm, based on the interaction among the swarm.

The FWA mimics the procedure of the firework explosion, where stronger firework explodes into more sparks. To get the details of the FWA, we refer you to the original paper.

This package provides easy acess to the advanced variants of FWA, maintained by the Computational Intelligence Laboratory (CIL), Peking University.

Install

To install the package, run the following commands:

git clone https://github.com/CavalloneChen/firework-algorithm.git
cd firework-algorithm
python3 setup.py install

If you do not have the sudo authority, try python3 setup.py install --user instead.

Usage

After installing the package, you can include the package anywhere on your machine, i.e.,

import fwa.BBFWA as BBFWA

algo = BBFWA()
obj_func = lambda x: [sum([_ * _ for _ in xi]) for xi in x]
algo.load_prob(evaluator=obj_func,
	dim=30,
	max_eval=30*10000,
	)
result = algo.run()

The algorithm in this package minimizes the objective function. Therefore, if you want to maximize instead, convert the objectve function by changing the sign of the fitness. And note that the evalutor takes a batch of samples as input and returns a list of scalars.

To run the optimizer, we first should set the range (if there is a restriction) and the number of evaluation.

There are several examples of previous proposed algorithms in the example directory, tested with CEC benchmarks. For easilly reproducing the results on the standard benchmarks, we also provides the benchmarks package at https://github.com/wead-hsu/ec-benchmarks, where the uasage of the benchmark package is illustrated. For simplicity, we also provide a simple script in the example dir to install the benchmark pacakge.

Contact

Computational Intelligence Laboratory (CIL), Peking University

About

Repository of firework algorithm variants.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 93.7%
  • Python 6.3%