feat(mean_field): Add Python bindings and comprehensive tutorial notebook

- Add python_bindings.rs with MFGConfigPy and solve_mfg_1d_rust
- Update notebook to compare Rust vs Python implementations
- Add performance benchmarking and accuracy validation
- Include convergence plots and 3D visualizations
- Update __init__.py to expose MFG functions

Note: Python bindings need maturin build due to macOS linker issues with cargo
This commit is contained in:
Melvin Alvarez
2026-01-04 14:52:14 +01:00
parent 531b5fd867
commit 1a866da60b
5 changed files with 464 additions and 80 deletions
+8 -1
View File
@@ -39,12 +39,16 @@ from optimizr.core import (
Griewank,
)
# Try to import maths_toolkit from Rust backend
# Try to import maths_toolkit and mean_field from Rust backend
try:
from optimizr import _core
maths_toolkit = _core
MFGConfig = _core.MFGConfigPy
solve_mfg_1d_rust = _core.solve_mfg_1d_rust
except (ImportError, AttributeError):
maths_toolkit = None
MFGConfig = None
solve_mfg_1d_rust = None
__version__ = "0.2.0"
__all__ = [
@@ -76,4 +80,7 @@ __all__ = [
"Ackley",
"Griewank",
"maths_toolkit",
# Mean Field Games
"MFGConfig",
"solve_mfg_1d_rust",
]