diff --git a/module/move/optimization_tools/src/problems/traveling_salesman.rs b/module/move/optimization_tools/src/problems/traveling_salesman.rs index 2eab112158..ec00937ab5 100644 --- a/module/move/optimization_tools/src/problems/traveling_salesman.rs +++ b/module/move/optimization_tools/src/problems/traveling_salesman.rs @@ -98,11 +98,21 @@ pub struct Edge( NodeIndex, NodeIndex, EdgeWeight ); impl Edge { + /// Create new Edge + pub fn new( node1 : NodeIndex, node2 : NodeIndex, weight : EdgeWeight ) -> Self + { + Edge( node1, node2, weight ) + } /// Get weight of the edge. pub fn weight( &self ) -> EdgeWeight { self.2 } + /// Get nodes of the edge + pub fn nodes( &self ) -> ( NodeIndex, NodeIndex ) + { + ( self.0, self.1 ) + } } impl Graph for TSPGraph @@ -127,7 +137,7 @@ impl Graph for TSPGraph { if let Some( ( _, weight ) ) = node_vec.iter().find( | ( n, _ ) | n == node2 ) { - return Some( Edge( *node1, *node2, *weight ) ); + return Some( Edge::new( *node1, *node2, *weight ) ); } } None diff --git a/module/move/optimization_tools/tests/optimization.rs b/module/move/optimization_tools/tests/optimization.rs index 329cfbe213..3f631aced2 100644 --- a/module/move/optimization_tools/tests/optimization.rs +++ b/module/move/optimization_tools/tests/optimization.rs @@ -79,7 +79,6 @@ fn solve_with_sa() 000000013 "#; - let seed : Seed = "seed3".into(); let initial = SudokuInitial::new( Board::from( input ) ); let problem = Problem::new( initial, BestRowsColumnsCrossover, RandomPairInBlockMutation ); let optimizer = HybridOptimizer::new( Config::default(), problem );