# Routing with constraints

The following is the statement of the problem:
There are 40 packets to be delivered in a day. Each packet needs to be delivered to a
particular location. Apart from this, there are constraints also that some packets need to be
delivered before a certain time. And some packets need to be delivered together
There are two trucks and the total distance traveled by them together should be less
than 140. There is a table consisting of the distance between each pair of cities.
There are also constraints like a truck can carry a maximum of 16 packets

The detailed description of the problem is at
Here are some assumptions/constraints:
assumptions:

Each truck can carry a maximum of 16 packages. Trucks travel at an average speed of 18 miles per hour. Trucks have an “infinite amount of gas” with no need to stop. Each driver stays with the same truck as long as that truck is in service. Drivers leave the hub at 8:00 a.m., with the truck loaded, and can return to the hub for packages if needed. The day ends when all 40 packages have been delivered. Delivery time is instantaneous, i.e., no time passes while at a delivery (that time is factored into the average speed of the trucks). There is up to one special note for each package. The wrong delivery address for package #9, Third District Juvenile Court, will be corrected at 10:20 a.m. The correct address is 410 S State St., Salt Lake City, UT 84111. The package ID is unique; there are no collisions. No further assumptions exist or are allowed.

My Thoughts:
I am not really sure how to approach such kind of problem it appears very weird.
Is there a general algorithm to approach this kind of problem with so many constraints
I also found code for this on GitHub - https://github.com/plee1295/WGU-C950-Task
But I am not sure what algorithm is being used.
I am aware of several graph algorithms. But none of them deal with
this type of constraints

• I see a problem statement (please tell who originated it and where you encountered it) and thoughts, including a statement of sentiment. What is your answerable CS question? Commented Jul 11, 2021 at 14:56
• @greybeard The task is written in the GitHub repo link I posted. I wanted to solve it myself. Commented Jul 11, 2021 at 18:45
• We require you to credit the original source of all copied material. Please edit your question to follow our guidelines: cs.stackexchange.com/help/referencing
– D.W.
Commented Jul 11, 2021 at 21:13
• We discourage "here is my exercise/contest-style task, I don't know how to approach it, how do I solve it?" questions. What did you try? Where did you get stuck? We're happy to help you understand the concepts but just solving exercises for you is unlikely to achieve that. You might find this page helpful in improving your question.
– D.W.
Commented Jul 11, 2021 at 21:14
• The problem statement doesn't seem precise enough to be solved yet. "There are also constraints like..." is not a specification - giving one example of a possible constraint doesn't tell us what other constraints might also be possible. Without knowing the exact set of possible constraints, it's hard to suggest an algorithm.
– D.W.
Commented Jul 11, 2021 at 21:15