def test_interpret_nv3(self):
     """Test interpret for num_vehicles=3"""
     vehicle_routing = VehicleRouting(self.graph, num_vehicles=3)
     self.assertEqual(
         vehicle_routing.interpret(self.result_nv3),
         [[[0, 1], [1, 0]], [[0, 2], [2, 0]], [[0, 3], [3, 0]]],
     )
 def test_interpret_d2(self):
     """Test interpret for depot=2"""
     vehicle_routing = VehicleRouting(self.graph, depot=2)
     self.assertEqual(
         vehicle_routing.interpret(self.result_d2),
         [[[2, 0], [0, 1], [1, 2]], [[2, 3], [3, 2]]],
     )
 def test_edgelist(self):
     """Test _edgelist"""
     vehicle_routing = VehicleRouting(self.graph)
     self.assertEqual(
         vehicle_routing._edgelist(vehicle_routing.interpret(self.result)),
         [[0, 1], [1, 0], [0, 2], [2, 3], [3, 0]],
     )
Beispiel #4
0
 def test_edge_color_nv3(self):
     """Test _edge_color for num_vehicles=3"""
     vehicle_routing = VehicleRouting(self.graph, num_vehicles=3)
     self.assertEqual(
         vehicle_routing._edge_color(
             vehicle_routing.interpret(self.result_nv3)),
         [0.0, 0.0, 1 / 3, 1 / 3, 2 / 3, 2 / 3])
Beispiel #5
0
 def test_edge_color_d2(self):
     """Test _edge_color for depot=2"""
     vehicle_routing = VehicleRouting(self.graph, depot=2)
     self.assertEqual(
         vehicle_routing._edge_color(
             vehicle_routing.interpret(self.result_d2)),
         [0.0, 0.0, 0.0, 0.5, 0.5])
 def test_edge_color(self):
     """Test _edge_color"""
     vehicle_routing = VehicleRouting(self.graph)
     self.assertEqual(
         vehicle_routing._edge_color(vehicle_routing.interpret(
             self.result)),
         [0.0, 0.0, 0.5, 0.5, 0.5],
     )