NeverOnTimeSdnBhd / Delivery-Instances

2 stars 6 forks source link

Question about vehicle #19

Open xputerax opened 3 years ago

xputerax commented 3 years ago

I've been trying to wrap my head around the "Vehicle" thingy in this assignment. Is it a thread? A regular class/object? What's stopping me from creating 1 vehicle for each customer?

Let's say I create 3 vehicles, and I give each of them a list of customers, and they all move sequentially, i.e vehicle 1 fulfill all customer demands until finished, followed by vehicle 2 and 3.

Is my understanding correct?

NeverOnTimeSdnBhd commented 3 years ago

Hi

Vehicle is not a thread (but if you want to make it as a thread to satisfy one of the extra requirement is also possible). The reason stopping you from creating 1 vehicle for each customer is the cost, assigning every customer to different vehicles (e.g. if we have 5 customers thus create 5 vehicles and every vehicle handle one customer) will result in a very large cost. The cost is simply the Euclidean distance travelled by all vehicles. You can try take an example and calculate yourself.

Let's say I create 3 vehicles, and I give each of them a list of customers, and they all move sequentially, i.e vehicle 1 fulfill all customer demands until finished, followed by vehicle 2 and 3.

Yep this is the "real situation", but note that in basic requirement you just required to search the "plan", aka. searching the routes should be taken by certain amount of vehicles. In "real situation", it will be after you done searching the route, then you will give the route info to all vehicles involved and they will depart from depot simultaneously.