Expand description
§fcmaes-core
fcmaes-core provides fast, parallel, gradient-free optimization algorithms
implemented entirely in Rust. It is the reusable optimizer core of the
fcmaes-rust project and does not
compile, link, load, or call the historical C++ optimizer backend.
§Installation
cargo add fcmaes-coreThe minimum supported Rust version is 1.88.
§Minimal example
use fcmaes_core::{De, DeParams, Fitness};
fn sphere(x: &[f64]) -> f64 {
x.iter().map(|value| value * value).sum()
}
fn main() {
let dim = 5;
let lower = vec![-5.0; dim];
let upper = vec![5.0; dim];
let fitness = Fitness::bounded(dim, 1, &lower, &upper);
let params = DeParams {
max_evaluations: 20_000,
seed: 1,
..Default::default()
};
let mut optimizer = De::new(fitness, &[], &[], None, ¶ms);
let result = optimizer.optimize(&sphere);
println!(
"value={} evaluations={} x={:?}",
result.y, result.evaluations, result.x
);
}Use optimized builds for real workloads:
cargo run --release§Capabilities
- Differential Evolution, active CMA-ES, CR-FM-NES, PGPE and Dual Annealing
- BiteOpt and batched ask/tell optimization
- MODE multi-objective optimization
- independent, coordinated and weighted multi-objective retry
- CVT MAP-Elites, quality-diversity search and the Diversifier
- native multithreading and parallel batch evaluation
§Documentation
Avoid CPU oversubscription when combining retry-level and population-evaluation parallelism. Debug builds are not representative of optimizer performance.
§License
MIT
Re-exports§
pub use biteopt::BiteOpt;pub use biteopt::BiteParams;pub use biteopt::BiteResult;pub use biteopt::DeepBiteOpt;pub use biteopt::optimize_bite;pub use biteopt::validate_bite_inputs;pub use cmaes::AcmaResult;pub use cmaes::Cmaes;pub use cmaes::CmaesParams;pub use crfmnes::Crfmnes;pub use crfmnes::CrfmnesParams;pub use crfmnes::CrfmnesResult;pub use da::DaParams;pub use da::DaResult;pub use da::optimize_da;pub use de::De;pub use de::DeParams;pub use de::DeResult;pub use fitness::Fitness;pub use fitness::NAN_REPLACEMENT;pub use fitness::Objective;pub use fitness::parallel_batch;pub use mapelites::Archive;pub use mapelites::DiversifierParams;pub use mapelites::MapElitesParams;pub use mapelites::QdBatchFitness;pub use mapelites::QdFitness;pub use mapelites::diversify;pub use mapelites::diversify_batch;pub use mapelites::map_elites;pub use mapelites::map_elites_batch;pub use mapelites::map_elites_batch_with_progress;pub use mode::Mode;pub use mode::ModeParams;pub use mode::ModeResult;pub use moretry::MoRetryConfig;pub use moretry::MoRetryEntry;pub use moretry::MoRetryResult;pub use moretry::MultiObjective;pub use moretry::WeightedObjective;pub use moretry::moretry;pub use moretry::pareto_indices;pub use moretry::scalarize;pub use pgpe::Pgpe;pub use pgpe::PgpeParams;pub use pgpe::PgpeResult;pub use retry::AdvancedRetryConfig;pub use retry::RetryBounds;pub use retry::RetryConfig;pub use retry::RetryContext;pub use retry::RetryEntry;pub use retry::RetryImprovement;pub use retry::RetryResult;pub use retry::RetryRunResult;pub use retry::advanced_retry;pub use retry::retry;pub use rng::Rng;
Modules§
- biteopt
- BiteOpt — Rust port of Aleksey Vaneev’s BiteOpt
(https://github.com/avaneev/biteopt), from the C++
biteopt.h/biteaux.h. - cmaes
- Active CMA-ES — Rust port of the C++
acmaesoptimizer.cpp. - crfmnes
- CR-FM-NES — Rust port of the C++
crfmnes.cpp. - da
- Dual Annealing — Rust port of the C++
daoptimizer.cpp. - de
- Differential Evolution — Rust port of the C++
deoptimizer.cpp. - fitness
- Bounds handling, coordinate normalization, and (parallel) fitness
evaluation — the Rust port of
Fitness/evaluatorfrom the C++evaluator.h. - mapelites
- Quality-Diversity: CVT-MAP-Elites and the Diversifier meta-algorithm —
Rust equivalents of the pure-Python
fcmaes/mapelites.pyandfcmaes/diversifier.py. - mode
- MODE — Rust port of the C++
modeoptimizer.cpp. - moretry
- Parallel weighted-scalarization retry for multi-objective problems.
- pgpe
- PGPE — Rust port of the C++
pgpe.cpp. - retry
- Parallel optimization restart coordinators.
- rng
- Random number generation for the optimizers.
Constants§
- CORE_
VERSION - Version string of the core crate, surfaced through the Python build-info.
Functions§
- probe_
sum - Sum of a slice of f64 — the Phase 0 probe used to prove the Python → PyO3 → core call path is wired end to end.