1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Plugin architecture for custom optimizer development
//
// This module provides a comprehensive plugin system that allows developers to create,
// register, and use custom optimizers seamlessly with the existing optimizer ecosystem.
//
// # Plugin Architecture
//
// The plugin system consists of several key components:
// - Plugin trait definitions for optimizers and extensions
// - Plugin registry for discovery and management
// - Plugin loader for dynamic loading (when supported)
// - Plugin SDK with utilities and helpers
// - Plugin validation and testing framework
//
// # Examples
//
// ## Creating a Custom Optimizer Plugin
//
// ```no_run
// use optirs_core::plugin::{OptimizerPlugin, PluginCapabilities};
// use optirs_core::plugin::core::{PluginInfo, OptimizerConfig, OptimizerState};
// use optirs_core::error::{OptimError, Result};
// use scirs2_core::ndarray::Array1;
//
// #[derive(Debug, Clone)]
// struct MyCustomOptimizer {
// learning_rate: f64,
// }
//
// impl OptimizerPlugin<f64> for MyCustomOptimizer {
// fn step(&mut self, params: &Array1<f64>, gradients: &Array1<f64>) -> Result<Array1<f64>> {
// // Custom optimization logic
// Ok(params - &(gradients * self.learning_rate))
// }
//
// fn name(&self) -> &str { "MyCustomOptimizer" }
// fn version(&self) -> &str { "1.0.0" }
//
// fn plugin_info(&self) -> PluginInfo {
// PluginInfo {
// name: self.name().to_string(),
// version: self.version().to_string(),
// description: "A simple custom optimizer".to_string(),
// author: "Example Author".to_string(),
// ..PluginInfo::default()
// }
// }
//
// fn capabilities(&self) -> PluginCapabilities {
// PluginCapabilities::default()
// }
//
// fn initialize(&mut self, paramshapes: &[usize]) -> Result<()> { Ok(()) }
// fn reset(&mut self) -> Result<()> { Ok(()) }
// fn get_config(&self) -> OptimizerConfig { OptimizerConfig::default() }
// fn set_config(&mut self,
// config: OptimizerConfig) -> Result<()> { Ok(()) }
// fn get_state(&self) -> Result<OptimizerState> { Ok(OptimizerState::default()) }
// fn set_state(&mut self,
// state: OptimizerState) -> Result<()> { Ok(()) }
// fn clone_plugin(&self) -> Box<dyn OptimizerPlugin<f64>> {
// Box::new(self.clone())
// }
// }
// ```
// Examples are in the examples/ directory
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;