[pickup and delivery problem]Constraint failure in PDP problem with one-to-many requirements #2342
Unanswered
Killajam
asked this question in
Routing (and legacy CP) questions
Replies: 2 comments 13 replies
-
for k, v in Conf.same.items():
for poi in v:
routing.solver().Add(
routing.VehicleVar(k) == routing.VehicleVar(
poi)) It seems that after commenting out this code, the maximum distance limit function can be implemented normally. The operation of this step is mainly because I have some requirements that are one-to-many or many-to-one. I split the dots into multiple dots and made sure they are in the same car. Is there a problem with the code written here? |
Beta Was this translation helpful? Give feedback.
2 replies
-
So, you should try this instead: # Setting first solution heuristic.
# [START parameters]
search_parameters = pywrapcp.DefaultRoutingSearchParameters()
search_parameters.first_solution_strategy = (
routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC)
search_parameters.local_search_metaheuristic = (
routing_enums_pb2.LocalSearchMetaheuristic.GUIDED_LOCAL_SEARCH)
search_parameters.time_limit.FromSeconds(100)
# [END parameters] |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my PDP problem, there was a one-to-many transportation requirement and they had to be on the same vehicle.My specific approach is to divide points with multiple requirements into multiple points, such as :(A,B) (A,C) (A,D).
So I change the demand pair to (A1,B) (A2,C) (A3,D).
Then add A1,A2, and A3 to the constraints at the same point, for example:
But once I add this constraint, my distance constraint or my number constraint doesn't work, and the solver can't find a viable solution.But I'm pretty sure there must be a solution because I'm giving a big enough number of vehicles.Is there a problem with the constraints I added above?I have been perplexed by this problem for many days. Is there anyone who can give me some advice?
Here is my code:
Beta Was this translation helpful? Give feedback.
All reactions