Skip to content
/ mahf Public

A framework for modular construction and evaluation of metaheuristics.

License

Notifications You must be signed in to change notification settings

mahf-opt/mahf

Repository files navigation

MAHF

Crates.io docs.rs GitHub Workflow Status (with event) License

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.

Overview

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:

  • Simple and modular metaheuristic construction
  • Effortless state management and tracking
  • Ready-to-use collection of common operators
  • Templates for popular metaheuristics
  • Flexible logging of runtime information

Although MAHF has been developed primarily as a research tool, it can be used to solve real-world problems.

Getting Started

Requirements

Installation

Add the following to your Cargo.toml:

[dependencies]
mahf = "0.1.0"

Example

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.

Documentation

MAHF has extensive documentation, which should make it easy to get started.

Related Projects

Contributing

We welcome contributions from the community and appreciate your interest in improving this project. Please take a look at our contribution guide.

License

This project is licensed under the GNU General Public License v3.0.

Publications

Citing MAHF

If you use MAHF in a scientific publication, we would appreciate citations to the following paper or the technical report:

Conference Paper

Jonathan Wurth, Helena Stegherr, Michael Heider, Leopold Luley, and Jörg Hähner. 2023. Fast, Flexible, and Fearless: A Rust Framework for the Modular Construction of Metaheuristics. In Proceedings of the Companion Conference on Genetic and Evolutionary Computation (GECCO ’23 Companion), Association for Computing Machinery, New York, NY, USA, 1900–1909. DOI:https://doi.org/10.1145/3583133.3596335

@inproceedings{wurth2023,
  title = {Fast, {{Flexible}}, and {{Fearless}}: {{A Rust Framework}} for the {{Modular Construction}} of {{Metaheuristics}}},
  booktitle = {Proceedings of the {{Companion Conference}} on {{Genetic}} and {{Evolutionary Computation}}},
  author = {Wurth, Jonathan and Stegherr, Helena and Heider, Michael and Luley, Leopold and Hähner, Jörg},
  date = {2023-07-24},
  series = {{{GECCO}} '23 {{Companion}}},
  pages = {1900--1909},
  publisher = {{Association for Computing Machinery}},
  location = {{New York, NY, USA}},
  doi = {10.1145/3583133.3596335},
  url = {https://dl.acm.org/doi/10.1145/3583133.3596335},
  isbn = {9798400701207},
}

Technical Report

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

@report{stegherr2023,
  title = {A Framework for Modular Construction and Evaluation of Metaheuristics},
  author = {Stegherr, Helena and Luley, Leopold and Wurth, Jonathan and Heider, Michael and Hähner, Jörg},
  date = {2023},
  pages = {25},
  institution = {{Fakultät für Angewandte Informatik}},
  url = {https://opus.bibliothek.uni-augsburg.de/opus4/103452},
}

About

A framework for modular construction and evaluation of metaheuristics.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages