Kuifje02 / vrpy

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

How to implement piecewise linear costs ? #90

Open tcokyasar44 opened 3 years ago

tcokyasar44 commented 3 years ago

This is something between a question and a feature update, rather than an issue. With the trendiness of new vehicles, we may have the first x miles costing less than the x+ miles. Assume, a hybrid vehicle runs the first 50 miles on electric and has a cost of y per mile. After the 50 miles, it starts running on an alternative fuel that costs z per mile. First, is it possible to consider this problem in the current release?

Next, consider that I am talking about the DCHVRP version of the above problem. To make things (possibly) easier, assume the second vehicle type has the same cost regardless of the distance traveled. It is possible to address this problem?

Kuifje02 commented 3 years ago

This would be a nice feature. I don't think its possible right now.

Just to be sure, what exactly do you call DCHVRP ? Heterogeneous fleet, with simultaneous distribution and collection ? This should be possible.

tcokyasar44 commented 3 years ago

Heterogeneous fleet with distance/travel time constrained and capacitated VRP. Say, one fleet type has two cost parameters as explained above, and this fleet has capacity and travel time constraints. Then, there is another vehicle type with a single cost parameter, and this is also capacity and travel time-constrained. If I am defining a new problem (to the best of your knowledge), please let me know :)

tcokyasar44 commented 3 years ago

Explaining with the code:

G.add_edge(1, 2, cost = [[3,5], 6], time = [10])

Both vehicles traverse the same edge with the same time. The per unit travel time cost is fixed (6) for vehicle type 2. But, in type 1, we charge 3 cost unit for the first say 100 time units, but 5 cost units after 100 time units of travel.

Kuifje02 commented 3 years ago

Unfortunately this is not possible with the current version. I am not sure what this problem is refered to in the literature.