Crate metaheuristics_nature[−][src]
Expand description
A collection of nature-inspired meta-heuristic algorithms.
Terminology
For unifying the terms, in this documentation,
- “Iteration” is called “generation”.
- “Function” that evaluates value is called “objective function”.
- “Return value” of the objective function is called “fitness”.
Algorithm
There are two traits utility::Algorithm
and utility::Setting
.
The previous is used to design the optimization method,
and the latter is the setting interface.
Solver
is a simple interface for obtaining the solution, or analyzing the result.
This type allows you to use the pre-defined methods without importing any traits.
All provided methods are listed in the module methods
.
For making your owned method, please see utility::prelude
.
Objective Function
For a quick demo with callable object, please see Fx
or FxAdaptive
.
You can define your question as an objective function through implementing ObjFunc
,
and then the upper bound, lower bound, and objective function ObjFunc::fitness
should be defined.
The final answer is ObjFunc::result
, which is calculated from the design parameters.
Random Function
This crate use 64bit PRNG algorithm (utility::Rng
) to generate uniform random values,
before that, a random seed is required.
The seed is generated by getrandom
, please see its support platform.
Features
std
: Default feature. Enable standard library function, such as timing and threading.parallel
: Enable parallel function, let objective function running without ordered, usesrayon
. Disable it for the platform that doesn’t supported threading, or if your objective function is not complicate enough. This feature requiredstd
.js
: Support JavaScript random seed generation, especially for WebAssembly.libm
: If the standard library is not provided, some math functions might missing. This will disable some pre-implemented algorithms. However, there is a math library implemented in pure Rust, the name is same aslibm
. This feature can re-enable (or replace) the math functions by using thelibm
crate.
Re-exports
pub use crate::methods::*;
Modules
Macros
A tool macro used to generate multiple builder functions (methods).
Structs
A quick interface help to create objective function from a callable object.
A quick interface help to create adaptive objective function from a callable object.
A public API for using optimization methods.
Traits
A trait for the objective function.