Crates.io | mahf |
lib.rs | mahf |
version | 0.1.0 |
source | src |
created_at | 2023-07-14 08:05:51.541127 |
updated_at | 2023-07-14 08:05:51.541127 |
description | A framework for modular construction and evaluation of metaheuristics. |
homepage | |
repository | https://github.com/mahf-opt/mahf |
max_upload_size | |
id | 915909 |
size | 595,263 |
A framework for modular construction and evaluation of metaheuristics.
MAHF enables easy construction and experimental analysis of metaheuristics by decomposing them into their fundamental components.
The framework supports not only evolutionary algorithms, but also any other metaheuristic frameworks, including non-population-based, constructive, and especially hybrid approaches.
MAHF aims to make construction and modification of metaheuristics as simple and reliable as possible. It provides a comprehensive set of utilities for logging, evaluation, and comparison of these heuristics.
Key features include:
Although MAHF has been developed primarily as a research tool, it can be used to solve real-world problems.
gcc
or clang
Add the following to your Cargo.toml
:
[dependencies]
mahf = { git = "https://github.com/mahf-opt/mahf" }
A simple genetic algorithm for real-valued black-box optimization.
The example uses the common benchmark functions for MAHF.
use mahf::prelude::*;
use mahf_bmf::BenchmarkFunction;
let problem = BenchmarkFunction::sphere(/*dim: */ 30);
let ga = Configuration::builder()
.do_(initialization::RandomSpread::new(population_size))
.evaluate()
.update_best_individual()
.while_(conditions::LessThanN::iterations(n), |builder| {
builder
.do_(selection::Tournament::new(num_selected, size))
.do_(recombination::ArithmeticCrossover::new_insert_both(pc))
.do_(mutation::NormalMutation::new(std_dev, rm))
.do_(boundary::Saturation::new())
.evaluate()
.update_best_individual()
.do_(replacement::MuPlusLambda::new(max_population_size))
})
.build();
let state = ga.optimize(&problem, evaluate::Sequential::new())?;
println!("Best solution found: {:?}", state.best_individual());
More examples can be found in the examples directory.
Examples of heuristic templates can be found under heuristics.
For component implementations, see components.
MAHF has extensive documentation, which should make it easy to get started.
Just run
$ cargo doc --open
to build and open the documentation.
We welcome contributions from the community and appreciate your interest in improving this project. A contribution guide will follow shortly.
This project is licensed under the GNU General Public License v3.0.
If you use MAHF in a scientific publication, we would appreciate citations to the following paper:
Helena Stegherr, Leopold Luley, Jonathan Wurth, Michael Heider, and Jörg Hähner. 2023. A framework for modular construction and evaluation of metaheuristics. Fakultät für Angewandte Informatik. https://opus.bibliothek.uni-augsburg.de/opus4/103452
Bibtex entry:
@techreport{stegherr2023,
author = {Helena Stegherr and Leopold Luley and Jonathan Wurth and Michael Heider and J{\"o}rg H{\"a}hner},
title = {A framework for modular construction and evaluation of metaheuristics},
institution = {Fakult{\"a}t f{\"u}r Angewandte Informatik},
series = {Reports / Technische Berichte der Fakult{\"a}t f{\"u}r Angewandte Informatik der Universit{\"a}t Augsburg},
number = {2023-01},
pages = {25},
year = {2023},
}