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
§API map
| Problem | Start here |
|---|---|
| General bounded scalar optimization | De, Cmaes, or BiteOpt |
| High-dimensional or noisy search | Pgpe or Crfmnes |
| Independent or adaptive restarts | retry |
| Several competing objectives | mode and moretry |
| Diverse high-quality solutions | mapelites |
| External, GPU, service, or custom batch evaluator | the ask/tell methods on DE, CMA-ES, CR-FM-NES, PGPE, BiteOpt, and MODE |
Every public item is documented. Module pages provide runnable examples, algorithm references, parameter semantics, stopping behavior, and execution notes. The crate rejects undocumented public additions and broken rustdoc links at compile time.
§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, Aleksey Vaneev’s adaptive derivative-free optimizer.
- cmaes
- Active Covariance Matrix Adaptation Evolution Strategy (CMA-ES).
- crfmnes
- CR-FM-NES for high-dimensional derivative-free optimization.
- da
- Dual Annealing with optional bounded local search.
- de
- Differential Evolution (DE) for bounded, derivative-free optimization.
- fitness
- Bounds handling, coordinate normalization, and parallel evaluation.
- mapelites
- Quality-Diversity search with CVT-MAP-Elites and the Diversifier.
- mode
- Multi-objective Differential Evolution (MODE).
- moretry
- Parallel weighted-scalarization retry for multi-objective problems.
- pgpe
- Parameter-Exploring Policy Gradients (PGPE).
- 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 a slice of
f64.