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]],
     )
示例#2
0
 def test_edgelist_nv3(self):
     """Test _edgelist for num_vehicles=3"""
     vehicle_routing = VehicleRouting(self.graph, num_vehicles=3)
     self.assertEqual(
         vehicle_routing._edgelist(
             vehicle_routing.interpret(self.result_nv3)),
         [[0, 1], [1, 0], [0, 2], [2, 0], [0, 3], [3, 0]])
 def test_edgelist_d2(self):
     """Test _edgelist for depot=2"""
     vehicle_routing = VehicleRouting(self.graph, depot=2)
     self.assertEqual(
         vehicle_routing._edgelist(vehicle_routing.interpret(
             self.result_d2)),
         [[2, 0], [0, 1], [1, 2], [2, 3], [3, 2]],
     )