diff --git a/Cargo.toml b/Cargo.toml index 31af4b0..c5bcbd0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,24 +7,23 @@ categories = ["algorithms"] repository = "https://github.com/lucidfrontier45/localsearch" license-file = "LICENSE" readme = "README.md" -version = "0.13.0" +version = "0.13.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] rand = "0.8.5" -ordered-float = "4.1.1" -rayon = "1.8.0" -trait-set = "0.3.0" -auto_impl = "1.1.0" +ordered-float = "4.2.2" +rayon = "1.10.0" +auto_impl = "1.2.0" [target.'cfg(target_family = "wasm")'.dependencies] web-time = "1.1.0" [dev-dependencies] approx = "0.5.1" -indicatif = "0.17.7" +indicatif = "0.17.8" [lib] name = "localsearch" diff --git a/src/callback.rs b/src/callback.rs index 540e507..0df9588 100644 --- a/src/callback.rs +++ b/src/callback.rs @@ -2,8 +2,6 @@ use std::{cell::RefCell, rc::Rc}; -use trait_set::trait_set; - /// OptProgress expresses Optimization Progress that is passed to a [`OptCallbackFn`] #[derive(Debug, Clone)] pub struct OptProgress { @@ -29,7 +27,6 @@ impl OptProgress { } } -trait_set! { /// OptCallbackFn is a trait of a callback function for optimization /// Typical usage is to show progress bar and save current result to the file /// @@ -58,5 +55,6 @@ trait_set! { /// pb.set_position(op.iter as u64); /// }; /// ``` -pub trait OptCallbackFn = Fn(OptProgress); -} +pub trait OptCallbackFn: Fn(OptProgress) {} + +impl OptCallbackFn for F where F: Fn(OptProgress) {} diff --git a/src/optim/base.rs b/src/optim/base.rs index 3df7d4f..bf9739a 100644 --- a/src/optim/base.rs +++ b/src/optim/base.rs @@ -1,5 +1,4 @@ use auto_impl::auto_impl; -use trait_set::trait_set; use crate::{callback::OptCallbackFn, Duration, OptModel}; @@ -57,7 +56,7 @@ pub trait LocalSearchOptimizer { } } -trait_set! { - /// Transition probability function - pub trait TransitionProbabilityFn = Fn(ST, ST) -> f64; -} +/// Transition probability function +pub trait TransitionProbabilityFn: Fn(ST, ST) -> f64 {} + +impl TransitionProbabilityFn for F where F: Fn(ST, ST) -> f64 {}