Skip to content

Commit

Permalink
Merge pull request #1310 from YuliaProkopovych/opt-tools
Browse files Browse the repository at this point in the history
READY(optimization_tools): Fix warnings
  • Loading branch information
Wandalen authored May 3, 2024
2 parents 79f21ac + 5512c30 commit dc9d729
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 24 deletions.
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,3 @@ default-features = true
version = "~0.3.0"
path = "module/test/c"
default-features = true


[patch.crates-io]
pathfinder_geometry = { git = "https://github.com/servo/pathfinder.git" }
pathfinder_simd = { git = "https://github.com/servo/pathfinder.git" }
3 changes: 3 additions & 0 deletions module/move/optimization_tools/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[patch.crates-io]
pathfinder_geometry = { git = "https://github.com/servo/pathfinder.git" }
pathfinder_simd = { git = "https://github.com/servo/pathfinder.git" }
4 changes: 2 additions & 2 deletions module/move/optimization_tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ full = [
enabled = []
rapidity_6 = [] # to enable slow tests
static_plot = []
dynamic_plot = [ "static_plot", "plotters-backend", "piston_window" ]
lp_parse = [ "exmex" ]
dynamic_plot = [ "static_plot", "dep:plotters-backend", "dep:piston_window" ]
lp_parse = [ "dep:exmex" ]

[dependencies]
derive_tools = { workspace = true, features = [ "derive_more", "full", "strum" ] }
Expand Down
17 changes: 0 additions & 17 deletions module/move/optimization_tools/src/problems/sudoku/sudoku.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,11 @@ use iter_tools::Itertools;
trait BoardExt
{
/// Validate that each bloack has at least one non-fixed cell.
fn validate_each_block_has_non_fixed_cell( &self ) -> bool;
fn validate_block_has_non_fixed_cells( &self, block : BlockIndex ) -> bool;
}

impl BoardExt for Board
{
fn validate_each_block_has_non_fixed_cell( &self ) -> bool
{
for block in self.blocks()
{
let fixed = self.block_cells( block )
.map( | cell | self.cell( cell ) )
.fold( 0, | acc, e | if e == 0.into() { acc + 1 } else { acc } )
;
if fixed <= 1 || fixed >= 10
{
return false;
}
}
true
}

fn validate_block_has_non_fixed_cells( &self, block : BlockIndex ) -> bool
{
let fixed = self.block_cells( block )
Expand Down
1 change: 1 addition & 0 deletions module/move/optimization_tools/tests/ga_optimization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fn crossover()
/// cargo test solve_with_ga --release --features rapidity_6
///
#[ cfg( feature = "rapidity_6" ) ]
#[ ignore ]
#[ test ]
fn solve_with_ga()
{
Expand Down
3 changes: 3 additions & 0 deletions module/move/optimization_tools/tests/optimization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ fn initial_temperature()
/// cargo test solve_with_sa --release --features rapidity_6
///
#[ cfg( feature = "rapidity_6" ) ]
#[ ignore ]
#[ test ]
fn solve_with_sa()
{
Expand Down Expand Up @@ -106,6 +107,7 @@ fn solve_with_sa()
/// cargo test solve_empty_full_block --release --features rapidity_6
///
#[ cfg( feature = "rapidity_6" ) ]
#[ ignore ]
#[ test ]
fn solve_empty_full_block()
{
Expand Down Expand Up @@ -182,6 +184,7 @@ fn solve_empty_full_block()
/// cargo test time_measure --release --features rapidity_6
///
#[ cfg( feature = "rapidity_6" ) ]
#[ ignore ]
#[ test ]
fn time_measure()
{
Expand Down
1 change: 1 addition & 0 deletions module/move/optimization_tools/tests/traveling_salesman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ fn tsp_person_mutate()
a_id!( person.route.len() - 1, unique.len() );
}

#[ ignore ]
#[ test ]
fn find_route()
{
Expand Down

0 comments on commit dc9d729

Please sign in to comment.