CmaesCanonicalConfig

Struct CmaesCanonicalConfig 

Source
pub struct CmaesCanonicalConfig {
Show 26 fields pub population_size: usize, pub max_generations: usize, pub seed: u64, pub c1: Option<f64>, pub c_mu: Option<f64>, pub c_sigma: Option<f64>, pub d_sigma: Option<f64>, pub parallel_eval: bool, pub verbosity: u8, pub ipop_restarts: usize, pub ipop_increase_factor: f64, pub bipop_restarts: usize, pub total_evals_budget: usize, pub use_subrun_budgeting: bool, pub alpha_mu: Option<f64>, pub hsig_threshold_factor: Option<f64>, pub bipop_small_population_factor: Option<f64>, pub bipop_small_budget_factor: Option<f64>, pub bipop_large_budget_factor: Option<f64>, pub bipop_large_pop_increase_factor: Option<f64>, pub max_bound_iterations: Option<usize>, pub eig_precision_threshold: Option<f64>, pub min_eig_value: Option<f64>, pub matrix_op_threshold: Option<f64>, pub stagnation_limit: Option<usize>, pub min_sigma: Option<f64>,
}
Expand description

Configuration for canonical CMA-ES with evolution paths and rank updates.

This struct contains all parameters that control the behavior of the CMA-ES algorithm. Most parameters have sensible defaults and can be left as None to use automatic values.

§Basic Parameters

The most important parameters for typical usage are:

  • population_size: Controls exploration vs exploitation trade-off
  • max_generations: Maximum number of generations to run
  • parallel_eval: Enable parallel function evaluation
  • verbosity: Control output level

§Advanced Parameters

Advanced users can fine-tune the algorithm behavior using learning rates, restart strategies, and numerical precision settings.

§Example

use cmaes_lbfgsb::cmaes::CmaesCanonicalConfig;
 
// Basic configuration
let config = CmaesCanonicalConfig {
    population_size: 20,
    max_generations: 1000,
    parallel_eval: true,
    verbosity: 1,
    ..Default::default()
};
 
// Advanced configuration with restarts
let advanced_config = CmaesCanonicalConfig {
    population_size: 50,
    max_generations: 500,
    ipop_restarts: 3,
    total_evals_budget: 100000,
    use_subrun_budgeting: true,
    ..Default::default()
};

Fields§

§population_size: usize

Population size (number of candidate solutions per generation).

Default: 0 (automatic: 4 + 3⌊ln(n)⌋ where n is problem dimension)

Typical range: 10-100 for most problems

Larger values: Better global exploration, slower convergence, more robust Smaller values: Faster convergence, risk of premature convergence

Guidelines:

  • Easy problems (unimodal): Use smaller populations (10-20)
  • Difficult problems (multimodal): Use larger populations (50-100+)
  • High-dimensional problems: Consider automatic sizing
§max_generations: usize

Maximum number of generations per run.

Default: 500

Guidelines:

  • Simple problems: 100-500 generations usually sufficient
  • Complex problems: 1000-5000+ generations may be needed
  • Use with total_evals_budget for better control

If sub-run budgeting is disabled, each run uses this value for generations. Otherwise, sub-runs can get smaller or larger generation budgets.

§seed: u64

Random seed for reproducible results.

Default: 42

Set to different values to get different random runs, or keep the same for reproducible experiments.

§c1: Option<f64>

Learning rate for rank-one update of covariance matrix.

Default: None (automatic: 2/((n+1.3)² + μ_eff))

Typical range: 0.0001 - 0.1

Controls how quickly the algorithm adapts to the search direction. Smaller values = more conservative adaptation.

§c_mu: Option<f64>

Learning rate for rank-μ update of covariance matrix.

Default: None (automatic: depends on μ_eff and problem dimension)

Typical range: 0.001 - 1.0

Controls how much the population covariance influences the search distribution. Must be balanced with c1 to ensure proper covariance matrix updates.

§c_sigma: Option<f64>

Learning rate for cumulation path for step-size control.

Default: None (automatic: (μ_eff + 2)/(n + μ_eff + 5))

Typical range: 0.1 - 1.0

Controls the step-size adaptation speed. Larger values lead to faster step-size changes but may cause instability.

§d_sigma: Option<f64>

Damping parameter for step-size update.

Default: None (automatic: 1 + 2max(0, √((μ_eff-1)/(n+1)) - 1))

Typical range: 1.0 - 10.0

Controls the damping of step-size updates. Larger values = more conservative step-size changes, which can improve stability but slow adaptation.

§parallel_eval: bool

Enable parallel evaluation of candidate solutions.

Default: false

When true, the population is evaluated in parallel using Rayon. Recommended for expensive objective functions. Disable for very fast functions where parallelization overhead exceeds benefits.

§verbosity: u8

Verbosity level for progress output.

Levels:

  • 0: Silent (no output)
  • 1: Basic progress (every 10 generations)
  • 2: Detailed debug information

Default: 0

§ipop_restarts: usize

Number of IPOP (Increasing Population) restarts.

Default: 0 (no IPOP restarts)

Typical range: 0-5 restarts

IPOP restarts the algorithm with increasing population sizes when it gets stuck. Each restart doubles the population size by default. Effective for multimodal problems but increases computational cost.

Note: BIPOP overrides IPOP if both are > 0.

§ipop_increase_factor: f64

Factor by which population size is multiplied each IPOP restart.

Default: 2.0

Typical range: 1.5 - 3.0

Controls how aggressively the population size grows with each restart. Larger factors provide better exploration but increase cost exponentially.

§bipop_restarts: usize

Number of BIPOP (Bi-Population) restarts.

Default: 0 (no BIPOP restarts)

Typical range: 0-10 restarts

BIPOP alternates between small and large population runs. More sophisticated than IPOP and often more effective for difficult multimodal problems.

Note: BIPOP overrides IPOP if both are > 0.

§total_evals_budget: usize

Total function-evaluations budget across all runs.

Default: 0 (no budget limit)

Typical values: 10,000 - 1,000,000 depending on problem complexity

When combined with use_subrun_budgeting, this budget is intelligently allocated across multiple restart runs.

§use_subrun_budgeting: bool

Enable advanced sub-run budgeting logic for IPOP/BIPOP.

Default: false

When true, the total_evals_budget is strategically allocated across restart runs rather than running each to completion. This often provides better results within a fixed computational budget.

§alpha_mu: Option<f64>

Alpha parameter used in c_mu calculation.

Default: Some(2.0)

Typical range: 1.0 - 4.0

Advanced parameter that influences the balance between rank-1 and rank-μ updates of the covariance matrix. Rarely needs adjustment.

§hsig_threshold_factor: Option<f64>

Threshold factor for the evolution path test in step-size control.

Default: Some(1.4)

Typical range: 1.0 - 2.0

Controls when to halt the cumulation of the evolution path based on its length. Affects the balance between exploration and exploitation.

§bipop_small_population_factor: Option<f64>

Factor for small population size calculation in BIPOP.

Default: Some(0.5)

Typical range: 0.1 - 0.8

In BIPOP, determines the size of “small” population runs relative to the baseline population size. Smaller values = more focused local search.

§bipop_small_budget_factor: Option<f64>

Budget allocation factor for small BIPOP runs.

Default: Some(1.0)

Typical range: 0.5 - 2.0

Controls how much of the evaluation budget is allocated to small population runs in BIPOP. Values > 1.0 give more budget to exploitation phases.

§bipop_large_budget_factor: Option<f64>

Budget allocation factor for large BIPOP runs.

Default: Some(3.0)

Typical range: 1.0 - 5.0

Controls how much of the evaluation budget is allocated to large population runs in BIPOP. Values > 1.0 give more budget to exploration phases.

§bipop_large_pop_increase_factor: Option<f64>

Factor for large population size increase in BIPOP.

Default: Some(2.0)

Typical range: 1.5 - 3.0

Controls how the large population size grows with each BIPOP restart. Similar to ipop_increase_factor but for BIPOP large runs.

§max_bound_iterations: Option<usize>

Maximum number of iterations for bounds mirroring.

Default: Some(8)

Typical range: 5 - 20

When candidates violate bounds, they are “mirrored” back into the feasible region. This parameter limits how many mirror operations are performed before clamping to bounds.

§eig_precision_threshold: Option<f64>

Numerical precision threshold for eigendecomposition convergence.

Default: Some(1e-15)

Typical range: 1e-20 to 1e-10

Controls the precision of the eigendecomposition of the covariance matrix. Smaller values = higher precision but potentially slower computation.

§min_eig_value: Option<f64>

Minimum threshold for covariance matrix eigenvalues.

Default: Some(1e-15)

Typical range: 1e-20 to 1e-10

Prevents numerical issues by ensuring eigenvalues don’t become too small. Smaller values allow more aggressive adaptation but risk numerical instability.

§matrix_op_threshold: Option<f64>

Minimum threshold for matrix operations.

Default: Some(1e-20)

Typical range: 1e-25 to 1e-15

General numerical threshold for matrix computations to prevent underflow and maintain numerical stability.

§stagnation_limit: Option<usize>

Maximum stagnation generations before termination.

Default: Some(200)

Typical range: 50 - 1000

Algorithm terminates if no improvement is seen for this many consecutive generations. Prevents infinite runs on problems where the optimum has been reached within tolerance.

§min_sigma: Option<f64>

Minimum sigma value to prevent numerical issues.

Default: Some(1e-8)

Typical range: 1e-12 to 1e-6

Prevents the step-size from becoming so small that progress stops due to numerical precision limits. Should be much smaller than expected parameter scales.

Trait Implementations§

Source§

impl Default for CmaesCanonicalConfig

Source§

fn default() -> CmaesCanonicalConfig

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V