Release v0.2.0: Comprehensive DE, Mathematical Toolkit, Optimal Control
Major Features: • Comprehensive Differential Evolution with 5 strategies (rand1, best1, currenttobest1, rand2, best2) • Adaptive jDE algorithm for self-tuning F and CR parameters • Convergence tracking with history records and early stopping • Mathematical toolkit module (780 lines): gradient, hessian, jacobian, statistics, linear algebra • Optimal control framework: HJB solvers, regime switching, jump diffusion, MRSJD • Sparse optimization: Sparse PCA, Box-Tao decomposition, ADMM, Elastic Net • Rayon parallelization infrastructure (ready for pure Rust objectives) Performance: • 74-88× speedup for DE vs SciPy • 50-100× speedup overall vs pure Python Refactoring & Cleanup: • Removed 5 legacy files (de_refactored.rs, hmm_legacy.rs, hmm_refactored.rs, mcmc_legacy.rs, mcmc_refactored.rs) • Modular architecture with trait-based design • Generic implementations (no domain-specific code) • Updated Python bindings for new DE API • Fixed ALL compilation warnings (0 errors, 0 warnings) Documentation: • Updated README with v0.2.0 features and benchmarks • Created RELEASE_NOTES_v0.2.0.md (comprehensive changelog) • New optimal control tutorial notebook (03_optimal_control_tutorial.ipynb) • Updated API examples in README • Created test_release.py for release validation Version Bumps: • Cargo.toml: 0.1.0 → 0.2.0 • pyproject.toml: 0.1.0 → 0.2.0 • python/__init__.py: 0.1.0 → 0.2.0 Breaking Changes: • DE API: mutation_factor/crossover_rate → f/cr • DE API: use_adaptive_jde → adaptive • DE API: strategy names simplified (e.g., 'rand/1/bin' → 'rand1') • DE returns: (x, fun) tuple instead of dict-like object Known Items (Post-Release): • Mathematical toolkit functions available in Rust but not yet exposed to Python • MCMC Python wrapper needs API update to match new Rust implementation • Tutorial notebooks need DE API updates Tests: 34 Rust tests passing, core Python functionality validated with test_release.py
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
//! Optimal Control Module
|
||||
//! ======================
|
||||
//!
|
||||
//! Generic optimal control algorithms for dynamical systems.
|
||||
//!
|
||||
//! # Features
|
||||
//!
|
||||
//! - Generic HJB PDE solver with finite differences
|
||||
//! - Viscosity solutions for non-smooth value functions
|
||||
//! - Upwind schemes for numerical stability
|
||||
//! - Parallel processing support
|
||||
//!
|
||||
//! # Mathematical Foundation
|
||||
//!
|
||||
//! ## Hamilton-Jacobi-Bellman Equation
|
||||
//!
|
||||
//! For a general stochastic process dX_t = μ(X_t)dt + σ(X_t)dW_t,
|
||||
//! the HJB equation is:
|
||||
//!
|
||||
//! ρV(x) = sup_u [μ(x,u)V'(x) + (σ²(x,u)/2)V''(x) + L(x,u)]
|
||||
//!
|
||||
//! where:
|
||||
//! - V(x) is the value function
|
||||
//! - ρ is the discount rate
|
||||
//! - u is the control
|
||||
//! - L(x,u) is the running cost
|
||||
//!
|
||||
//! ## Viscosity Solutions
|
||||
//!
|
||||
//! Handle non-smooth value functions via:
|
||||
//! 1. Finite difference discretization
|
||||
//! 2. Upwind schemes for stability
|
||||
//! 3. Iterative convergence to viscosity solution
|
||||
|
||||
pub mod hjb_solver;
|
||||
pub mod jump_diffusion;
|
||||
pub mod mrsjd;
|
||||
pub mod regime_switching;
|
||||
pub mod viscosity;
|
||||
|
||||
pub use hjb_solver::{HJBConfig, HJBResult, HJBSolver};
|
||||
pub use jump_diffusion::{
|
||||
JumpDiffusionConfig, JumpDiffusionResult, JumpDiffusionSolver, JumpDistribution,
|
||||
};
|
||||
pub use mrsjd::{MRSJDConfig, MRSJDResult, MRSJDSolver, RegimeJumpParameters};
|
||||
pub use regime_switching::{
|
||||
RegimeParameters, RegimeSwitchingConfig, RegimeSwitchingResult, RegimeSwitchingSolver,
|
||||
};
|
||||
pub use viscosity::{ViscosityConfig, ViscositySolver};
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum OptimalControlError {
|
||||
#[error("Numerical error: {0}")]
|
||||
NumericalError(String),
|
||||
|
||||
#[error("Convergence failed: {0}")]
|
||||
ConvergenceError(String),
|
||||
|
||||
#[error("Invalid parameters: {0}")]
|
||||
InvalidParameters(String),
|
||||
|
||||
#[error("Insufficient data: need at least {0} points")]
|
||||
InsufficientData(usize),
|
||||
|
||||
#[error("Matrix computation error: {0}")]
|
||||
MatrixError(String),
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, OptimalControlError>;
|
||||
Reference in New Issue
Block a user