pub struct OptimizationRecorder { /* private fields */ }Expand description
Records optimization progress for every function evaluation
Implementations§
Source§impl OptimizationRecorder
impl OptimizationRecorder
Sourcepub fn new(function_name: String) -> Self
pub fn new(function_name: String) -> Self
Create a new optimization recorder for the given function Uses the default records directory under AUTOEQ_DIR/data_generated/records
Sourcepub fn with_output_dir(function_name: String, output_dir: String) -> Self
pub fn with_output_dir(function_name: String, output_dir: String) -> Self
Create a new optimization recorder with custom output directory
Sourcepub fn record_evaluation(&self, x: &Array1<f64>, f_value: f64)
pub fn record_evaluation(&self, x: &Array1<f64>, f_value: f64)
Record a single function evaluation
Sourcepub fn set_generation(&self, generation: usize)
pub fn set_generation(&self, generation: usize)
Set the current generation number
Sourcepub fn create_callback(
&self,
) -> Box<dyn FnMut(&DEIntermediate) -> CallbackAction + Send>
pub fn create_callback( &self, ) -> Box<dyn FnMut(&DEIntermediate) -> CallbackAction + Send>
Create a callback function that updates generation number
Sourcepub fn finalize(&self) -> Result<Vec<String>, Box<dyn Error>>
pub fn finalize(&self) -> Result<Vec<String>, Box<dyn Error>>
Save any remaining records and finalize
Sourcepub fn save_to_csv(&self, output_dir: &str) -> Result<String, Box<dyn Error>>
pub fn save_to_csv(&self, output_dir: &str) -> Result<String, Box<dyn Error>>
Legacy method: Save all recorded iterations to a CSV file (for compatibility)
Sourcepub fn get_records(&self) -> Vec<OptimizationRecord>
pub fn get_records(&self) -> Vec<OptimizationRecord>
Get a copy of all recorded iterations (legacy compatibility - returns empty)
Sourcepub fn num_iterations(&self) -> usize
pub fn num_iterations(&self) -> usize
Get the number of evaluations recorded
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OptimizationRecorder
impl RefUnwindSafe for OptimizationRecorder
impl Send for OptimizationRecorder
impl Sync for OptimizationRecorder
impl Unpin for OptimizationRecorder
impl UnsafeUnpin for OptimizationRecorder
impl UnwindSafe for OptimizationRecorder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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