Kuifje02 / vrpy

A python framework for solving the VRP and its variants with column generation.
MIT License
179 stars 43 forks source link

Mixed Fleet #25

Closed egh312 closed 4 years ago

egh312 commented 4 years ago

I've been playing around with the mixed fleet (HCVRP)

I can't seem to get VRP to run with it returning a TypeError (see attached)

image

Edge 'cost': [('Source', 1, [407, 407]), ('Source', 2, [13916, 13916]), ('Source', 3, [189591, 189591]), ('Source', 4, [190473, 190473]), ('Source', 'Sink', 0), (1, 2, [13805, 13805]), (1, 3, [189480, 189480]), (1, 4, [190361, 190361]), (1, 'Sink', [407, 407]), (2, 1, [13694, 13694]), (2, 3, [176398, 176398]), (2, 4, [177280, 177280]), (2, 'Sink', [13925, 13925]), (3, 1, [189098, 189098]), (3, 2, [176331, 176331]), (3, 4, [1943, 1943]), (3, 'Sink', [189328, 189328]), (4, 1, [189515, 189515]), (4, 2, [176749, 176749]), (4, 3, [1943, 1943]), (4, 'Sink', [189746, 189746])]

Demand:
{1: 5, 2: 5, 3: 5, 4: 2}

Also, if it helps, thought i'd share that transforming from a distance/adjacency matrix to a networkx directional graph (DIiGraph) is a little tricky when using a cost for each vehicle. My limited coding skills were unable to build the graph from the prebuilt networkx functions (namely from_numpy_matrix/array etc) so resorted to list manipulation.

Kuifje02 commented 4 years ago

Thanks for your feedback again. Sure, share your code, always helpful !

I think I know where the issue is. Could you try something (as a quick fix) ? :

prob = vrp.VehicleRoutingProblem(G, mixed_fleet=True, load_capacity=[8,9], fixed_cost=[1,2])

should work (Instead of defining the attributes in 3 steps).

egh312 commented 4 years ago

Seems mixed_fleet doesn't exist in init!

image

Kuifje02 commented 4 years ago

Aaa ! yes! In version 0.1.0, mixed_fleet is not available yet. It will be available in the next relase (coming very soon). It is already in the docs, and already implemented...just not released yet :)

egh312 commented 4 years ago

Perfect! Looking forward to it!

Kuifje02 commented 4 years ago

@egh312 v 0.2.0 released!

egh312 commented 4 years ago

Awesome work - looks good :)