pub struct WarmStartLibrary { /* private fields */ }Expand description
Stored solutions keyed by task descriptors, looked up by Euclidean distance.
A linear scan: libraries of hundreds of entries (Yue et al. store 567) are scanned in microseconds, and an index would only pay off for far larger ones.
use evolutionary_planning::de::WarmStartLibrary;
let mut library = WarmStartLibrary::new();
library.insert(vec![0.6, 0.2], vec![1.0, 2.0, 3.0]);
library.insert(vec![0.0, 0.0], vec![0.0, 0.0, 0.0]);
let (distance, solution) = library.nearest(&[0.58, 0.21], 0.05).expect("within radius");
assert!(distance < 0.05);
assert_eq!(solution, &[1.0, 2.0, 3.0]);
assert!(library.nearest(&[0.3, 0.3], 0.05).is_none());Implementations§
Source§impl WarmStartLibrary
impl WarmStartLibrary
Sourcepub fn insert(&mut self, descriptor: Vec<f64>, solution: Vec<f64>)
pub fn insert(&mut self, descriptor: Vec<f64>, solution: Vec<f64>)
Stores solution for the task described by descriptor.
Trait Implementations§
Source§impl Clone for WarmStartLibrary
impl Clone for WarmStartLibrary
Source§impl Debug for WarmStartLibrary
impl Debug for WarmStartLibrary
Source§impl Default for WarmStartLibrary
impl Default for WarmStartLibrary
Source§impl PartialEq for WarmStartLibrary
impl PartialEq for WarmStartLibrary
impl StructuralPartialEq for WarmStartLibrary
Auto Trait Implementations§
impl Forget for WarmStartLibrary
impl Freeze for WarmStartLibrary
impl Move for WarmStartLibrary
impl RefUnwindSafe for WarmStartLibrary
impl Send for WarmStartLibrary
impl Sync for WarmStartLibrary
impl Unpin for WarmStartLibrary
impl UnsafeUnpin for WarmStartLibrary
impl UnwindSafe for WarmStartLibrary
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