pub trait SearchSpace<N,B> {
fn initial(&mut self) -> N;
fn bound(&mut self, node: &N) -> B;
fn goal(&mut self, node: &N) -> bool;
fn g_cost(&mut self, n: &N) -> B;
fn handle_new_best(&mut self, node: N) -> N { node }
fn start_search(&mut self, _msg: String) {}
fn restart(&mut self, _msg: String) {}
fn stop_search(&mut self, _msg: String) {}
fn display_statistics(&self) {}
fn json_statistics(&self, _json:&mut serde_json::Value) {}
fn request_log_header(&self, _res:Vec<String>) {}
fn request_logging(&self, _res:Vec<String>) {}
}
pub trait ToSolution<N,Sol> {
fn solution(&mut self, node: &mut N) -> Sol;
}
pub trait GuidedSpace<N,G> {
fn guide(&mut self, node: &N) -> G;
}
pub trait TotalNeighborGeneration<N> {
fn neighbors(&mut self, node: &mut N) -> Vec<N>;
}
pub trait PartialNeighborGeneration<N> {
fn next_neighbor(&mut self, node: &mut N) -> Option<N>;
}
pub trait Identifiable<N, Id> {
fn id(&self, n: &mut N) -> Id;
}
pub trait ParetoDominanceSpace<N> {
fn dominates(&self, a:&N, b:&N) -> bool;
}
pub trait BoundedDistanceSpace<N> {
fn maximum_root_distance(&self) -> usize;
fn distance_from_root(&self, n:&N) -> usize;
fn root_distance_ratio(&self, n:&N) -> f64 {
self.distance_from_root(n) as f64 / self.maximum_root_distance() as f64
}
}