Crate metaheuristics_nature[−][src]
Expand description
A collection of nature-inspired metaheuristic algorithms.
use metaheuristics_nature::{Report, RGA, RGASetting, Solver, Task, ObjFunc}; let a = RGA::solve( MyFunc::new(), RGASetting::default().task(Task::MinFit(1e-20)), () // Run without callback ); let ans: f64 = a.result(); // Get the result from objective function let (x, y): (Array1<f64>, f64) = a.parameters(); // Get the optimized XY value of your function let history: Vec<Report> = a.history(); // Get the history reports
There are two traits Algorithm
and Solver
.
The previous is used to design the optimization method,
and the latter is a simple interface for obtaining the solution, or analyzing the result.
Solver
will automatically implement for the type which implements Algorithm
.
Objective Function
You can define your question as a objective function through implementing ObjFunc
.
First of all, the array types are ndarray::ArrayBase
.
And then you should define the upper bound, lower bound, and objective function ObjFunc::fitness
by yourself.
The final answer is ObjFunc::result
, which is generated from the design parameters.
Macros
Generate random boolean by positive factor.
Generate random values between [0., 1.) or by range.
Define a data structure and its builder functions.
Structs
The base class of algorithms.
Please see Algorithm
for more information.
Differential Evolution type.
Differential Evolution settings.
Firefly Algorithm type.
Firefly Algorithm settings.
Particle Swarm Optimization type.
Particle Swarm Optimization settings.
Real-coded Genetic Algorithm type.
Real-coded Genetic Algorithm settings.
The data of generation sampling.
Base settings.
Teaching Learning Based Optimization type.
Enums
The Differential Evolution strategy. Each strategy has different formulas on the recombination.
The terminal condition of the algorithm setting.
Traits
The methods of the metaheuristic algorithms.
A trait for fitting different callback functions.
The base of the objective function.
A public API for Algorithm
.
Type Definitions
Teaching Learning Based Optimization settings.
This is a type alias to Setting
.