Crate metaheuristics_nature[][src]

Expand description

A collection of nature-inspired metaheuristic algorithms.

use metaheuristics_nature::{Report, RGA, RGASetting, Setting, Solver, Task};

fn main() {
    let mut a = RGA::new(
        MyObj::new(),
        RGASetting::default().task(Task::MinFit(1e-20)),
    );
    let ans = a.run();  // Run and get the final result
    let (x, y): (Vec<f64>, f64) = a.result();  // Get the optimized XY value of your function
    let reports: Vec<Report> = a.history();  // Get the history reports.
}

Features

  • cli: Enable progress bar for CLI.

Macros

maybe

Generate random boolean by positive factor.

rand

Generate random values between [0., 1.) or by range.

setting_builder

Define a data structure and its builder functions.

Structs

AlgorithmBase

The base class of algorithms. Please see Algorithm for more information.

DE

Differential Evolution type.

DESetting

Differential Evolution settings.

FA

Firefly Algorithm type.

FASetting

Firefly Algorithm settings.

PSO

Particle Swarm Optimization type.

PSOSetting

Particle Swarm Optimization settings.

RGA

Real-coded Genetic Algorithm type.

RGASetting

Real-coded Genetic Algorithm settings.

Report

The data of generation sampling.

Setting

Base settings.

TLBO

Teaching Learning Based Optimization type.

Enums

Strategy

The Differential Evolution strategy. Each strategy has different formula on recombination.

Task

The terminal condition of the algorithm setting.

Traits

Algorithm

The methods of the metaheuristic algorithms.

ObjFunc

The base of the objective function.

Solver

The public API for Algorithm.

Type Definitions

TLBOSetting

Teaching Learning Based Optimization settings. This is a type alias to Setting.