mahf

Crates.iomahf
lib.rsmahf
version0.1.0
sourcesrc
created_at2023-07-14 08:05:51.541127
updated_at2023-07-14 08:05:51.541127
descriptionA framework for modular construction and evaluation of metaheuristics.
homepage
repositoryhttps://github.com/mahf-opt/mahf
max_upload_size
id915909
size595,263
Jonathan Wurth (Saethox)

documentation

README

MAHF

GitHub Workflow Status (with event) GitHub

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 = { git = "https://github.com/mahf-opt/mahf" }

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.

Just run

$ cargo doc --open

to build and open the documentation.

Related Projects

Contributing

We welcome contributions from the community and appreciate your interest in improving this project. A contribution guide will follow shortly.

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:

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},
}
Commit count: 610

cargo fmt