Kuifje02 / vrpy

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

define constraints #104

Open piaulous opened 3 years ago

piaulous commented 3 years ago

I’m looking/asking for a possibility to define constraints on my own for a CVRP. The constraints could look like that:

This should continuously be verified in each iteration, until a ring fitting to the constraints has been found.

Thanks in advance!

Kuifje02 commented 3 years ago

I’m looking/asking for a possibility to define constraints on my own for a CVRP. The constraints could look like that:

  • a ring should not exceed a max. total length

This is a resource constraint similar to the "max duration" constraint. Setting the max_duration to the max total length (and using the appropriate time matrix) should do the trick.

  • the cumulative node demand of a ring divided by a constant C should not exceed a certain value B

I think this is just another way of enforcing classical capacity constraints. Instead of having Sum(q(i),i=1..,n) <= Q, you want Sum(q(i),i=1..,n)/C <= B. So setting the max capacity to B x C should do the trick.

  • the value (calculated from constant values, node load and distances to neighbor nodes) of a node should not deceed/exceed a certain limit

I am not sure I understand this one. Could you be more specific ? Which value of a node should not exceed a limit ?

piaulous commented 3 years ago

I guess I have to go more into depth. I’m trying to use vrpy to model an electrical grid ring topology, which requires to also check if the generated rings satisfy technical constraints in every iteration. Before checking the constraints every ring has to be divided into two half rings. The ring is separated at the position between two nodes where the conveyed load flow is minimal. For this calculation just the node demands are needed.

Now the constraints have to be satisfied:

Distance constraint: The half ring length should not exceed max. allowed distance. Cumulative edge length (costs) is the half ring distance.

Current rating constraint: The current rating is calculated as cumulative demand of the half rings divided by a constant voltage [kW/V] = [A]. The current rating is constrained as well (upper limit).

Voltage stability constraint: Here the voltage change between two consecutive nodes is determined. This calculation is little bit more complex, but needs the distance between a node pair and the node demand. Voltage stability is computed for rings and half rings and has a upper and lower limit.

Your suggestions from above would perfectly work for a whole ring, but my bad I haven't mentioned the half ring splittage. Do you have an idea how to implement this?

Kuifje02 commented 3 years ago

Hmmm, sounds tricky. I am not sure if this is possible, as it requires checking cumulative resources on partial paths.