Skip to content

Commit

Permalink
Merge branch 'hotfix/0.12.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidfrontier45 committed May 29, 2024
2 parents 96657f1 + cc92281 commit 0c81297
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 36 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ categories = ["algorithms"]
repository = "https://github.com/lucidfrontier45/localsearch"
license-file = "LICENSE"
readme = "README.md"
version = "0.12.0"
version = "0.12.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -19,6 +19,9 @@ rayon = "1.8.0"
trait-set = "0.3.0"
auto_impl = "1.1.0"

[target.'cfg(target_family = "wasm")'.dependencies]
web-time = "1.1.0"

[dev-dependencies]
approx = "0.5.1"
indicatif = "0.17.7"
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pub use callback::{OptCallbackFn, OptProgress};
mod model;
pub use model::OptModel;

mod time_wrapper;
pub use time_wrapper::{Duration, Instant};

/// Crate verison string
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

Expand Down
4 changes: 1 addition & 3 deletions src/optim/base.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use std::time::Duration;

use auto_impl::auto_impl;
use trait_set::trait_set;

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

/// Optimizer that implements local search algorithm
#[auto_impl(&, Box, Rc, Arc)]
Expand Down
4 changes: 1 addition & 3 deletions src/optim/epsilon_greedy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::time::Duration;

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

use super::{base::LocalSearchOptimizer, GenericLocalSearchOptimizer};

Expand Down
9 changes: 2 additions & 7 deletions src/optim/generic.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
use std::{
cell::RefCell,
marker::PhantomData,
rc::Rc,
time::{Duration, Instant},
};
use std::{cell::RefCell, marker::PhantomData, rc::Rc};

use rand::Rng;
use rayon::prelude::*;

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

use super::{LocalSearchOptimizer, TransitionProbabilityFn};
Expand Down
4 changes: 1 addition & 3 deletions src/optim/hill_climbing.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::time::Duration;

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

use super::{EpsilonGreedyOptimizer, LocalSearchOptimizer};

Expand Down
4 changes: 1 addition & 3 deletions src/optim/logistic_annealing.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::time::Duration;

use ordered_float::NotNan;

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

use super::{GenericLocalSearchOptimizer, LocalSearchOptimizer};

Expand Down
4 changes: 1 addition & 3 deletions src/optim/relative_annealing.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::time::Duration;

use ordered_float::NotNan;

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

use super::{GenericLocalSearchOptimizer, LocalSearchOptimizer};

Expand Down
8 changes: 2 additions & 6 deletions src/optim/simulated_annealing.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
use std::{
cell::RefCell,
rc::Rc,
time::{Duration, Instant},
};
use std::{cell::RefCell, rc::Rc};

use ordered_float::NotNan;
use rand::Rng;
use rayon::prelude::*;

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

use super::LocalSearchOptimizer;
Expand Down
9 changes: 2 additions & 7 deletions src/optim/tabu_search.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
use std::{
cell::RefCell,
marker::PhantomData,
rc::Rc,
time::{Duration, Instant},
};
use std::{cell::RefCell, marker::PhantomData, rc::Rc};

use auto_impl::auto_impl;
use rayon::prelude::*;

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

use super::LocalSearchOptimizer;
Expand Down
5 changes: 5 additions & 0 deletions src/time_wrapper.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#[cfg(not(target_family = "wasm"))]
pub use std::time::{Duration, Instant};

#[cfg(target_family = "wasm")]
pub use web_time::{Duration, Instant};

0 comments on commit 0c81297

Please sign in to comment.