-
Notifications
You must be signed in to change notification settings - Fork 2
Initialisation
markkvdb edited this page Mar 10, 2017
·
1 revision
Load m
, the number of depots. Load K
, the number of vehicles types. Load n
, the number of customers.
Load distance matrix distanceMatrix
into Matrix datatype with dimensions (n + m) x (n + m).
Create depot matrix depotMatrix
with dimensions m x (K + 1).
Load customer matrix customerMatrix
with dimension n x 2.
Load vehicle matrix vehicleMatrix
with dimension K x 4
For each depot (m depots):
- Select row from
depotMatrix
- Set inventory by calling
Solution::addDepot(I_j)
- For each vehicle type:
- Add
n_jk
vehicles by callingDepot::addVehicle(k)
function
- Add
For each customer in customerMatrix
:
- Create customer by calling
Solution::addCustomer(demand, servicetime)
-
Sort
customerMatrix
on ascending demand. -
Create
depotCustomerAllocation
(is avector<vector<int>>
). CreatedepotCustomerDemand
. -
Loop over
customerMatrix
:- Create
leftoverDemand = customer.getDemand()
. - While
leftoverDemand > 0
- Find smallest distance to depots, say
smallDepot
. - Add customer.
- Find smallest distance to depots, say
- end
- Create
-
Loop over depot (m depots):
- Sort vehicles based on costs.
- Create
customerList
andcustomerDropOff
. - Loop over sorted vehicle list:
- Create
leftoverCapacity = vehicle.getCapacity()
- while (
leftoverCapacity > 0
) do- Take new customer from
depotCustomerAllocation
(first time random). - Add customer to
customerList
andcustomerDropOff
. - Update
leftoverCapacity
. - if (
leftoverCapacity >= demand
) then- Delete from
depotCustomerAllocation
.
- Delete from
- else update
depotCustomerDemand
.
- Take new customer from
- end
route = cheapestInsertion(customerList)
vehicle.setRoute(route, deliverQuantities)
Customers.addRoute(route, deliverQuantities)
- Create
- Create
route = {0, 0};
- While customerList is not empty
- For each customer in customerList
- For each insertion option (N - 1):
- Check if minimum
- For each insertion option (N - 1):
- Update route by inserting cheapest.
- Remove customer from customerList.
- For each customer in customerList
- Ready to rambo.