As the title says, I am facing a certain problem with implementing loading facilities in my VRP with time window and capacity constraints. The battery of the electric vehicles is represented by the capacity constraint, so electric vehicles don't visit nodes which would drain their battery live to/below zero.
After implementing nodes that represent bus stops with positive demands, the next step was to simulate loading facilities by implementing nodes with negative demand.
The idea was the following: a charger is represented by a node which 'service time' is 1 [min] and 'demand' is negative (f.ex. 0.5 [kWh]). With this logic, a vehicle could visit the node f.ex. 20 consecutive times to load its battery for 10 [kWh] in 20 [min].
All charger nodes are part of a disjunction, so if a vehicle doesn't need to load its battery, it doesn't have to visit the charger nodes.
So far so good, but the problem is, that this idea of visiting a node multiple times is against the very nature of a VRP, so I came up with the following ideas:
Idea 1:
The first solution I came up with would be to duplicate each charger node by 100 or so, so that there were enough charger nodes for all vehicles to visit and recharge their batteries. In my eyes this is a feasible, but not very elegant solution and it would make my distance matrix even huger, than they already are.
Idea 2:
The next idea I came up with was if it was possible to "reset" the state of specific nodes (in this case the charger nodes) after each routing step. If this was possible, one could reset the "visited state" of the charger nodes after each step (so they would be marked as "not visited") and only implement a duplication of the charger nodes by a number n with n being the number of the vehicles.
Now, even if all vehicles were to load at the same charger at the same time, they were able to rotate through the charger duplicate nodes. In my eyes, this solution would be much more elegant.
Do you think it is possible to implement idea 2? If not, do you think idea 1 would be the only solution for my problem or do you maybe have another ideas to solve this problem?
Thanks for any advice in advance!
Asked
Active
Viewed 125 times
1

nostripe
- 31
- 3
-
"_duplicate each charger node by 100_" you need to have physical charging stations before you can write software for this. Unfortunately, this is a site for coding, not hardware. – Nobody Sep 27 '22 at 06:04
-
What I meant by this was to duplicate one node by time 100 so that you have 100 nodes with the same coordinates and distance between them being 0. This question is about a VRP and the charger nodes as as theoretical as the bus stop nodes. So no sir, no hardware question. @Nobody – nostripe Sep 27 '22 at 07:04
-
1Your distance matrix doesn't need to be 10.000 times as large for solution 1, you can follow the strategy of using a Dictionary to map the duplicate nodes to their original node with a smaller distance matrix, as proposed in an answer in https://groups.google.com/g/or-tools-discuss/c/J1GA7QZ2Q1w/m/gsfvEGfKBAAJ – Christopher Hamkins Sep 27 '22 at 13:55
1 Answers
1
Idea 2 is not possible as you can't change the state of a node while the solver is running. In other words, the distance matrix is static.
Idea 1 is how I'd do in OR-Tools. I'd also add penalties to visiting each of them such as to visit as few charging nodes as possible.

k88
- 1,858
- 2
- 12
- 33