Skip to content

Commit

Permalink
Merge branch 'hotfix/0.13.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidfrontier45 committed Aug 12, 2024
2 parents 7d87715 + 456a1aa commit 9a2e914
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 3 additions & 5 deletions src/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<S, SC> {
Expand All @@ -29,7 +27,6 @@ impl<S, SC: Ord> OptProgress<S, SC> {
}
}

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
///
Expand Down Expand Up @@ -58,5 +55,6 @@ trait_set! {
/// pb.set_position(op.iter as u64);
/// };
/// ```
pub trait OptCallbackFn<S, SC: PartialOrd> = Fn(OptProgress<S, SC>);
}
pub trait OptCallbackFn<S, SC: PartialOrd>: Fn(OptProgress<S, SC>) {}

impl<F, S, SC: PartialOrd> OptCallbackFn<S, SC> for F where F: Fn(OptProgress<S, SC>) {}
9 changes: 4 additions & 5 deletions src/optim/base.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use auto_impl::auto_impl;
use trait_set::trait_set;

use crate::{callback::OptCallbackFn, Duration, OptModel};

Expand Down Expand Up @@ -57,7 +56,7 @@ pub trait LocalSearchOptimizer<M: OptModel> {
}
}

trait_set! {
/// Transition probability function
pub trait TransitionProbabilityFn<ST: Ord + Sync + Send + Copy> = Fn(ST, ST) -> f64;
}
/// Transition probability function
pub trait TransitionProbabilityFn<ST: Ord + Sync + Send + Copy>: Fn(ST, ST) -> f64 {}

impl<F, ST: Ord + Sync + Send + Copy> TransitionProbabilityFn<ST> for F where F: Fn(ST, ST) -> f64 {}

0 comments on commit 9a2e914

Please sign in to comment.