There are a number of orders, which needs to be shipped. For each order, there may be 1 to 3 route options. The problem here is to find out the best allocation (combination) of orders among these routes.
Suppose the full capacity and per km transport cost for each type of truck are:
7.6(size) -> 5300(weight), 4.4(cost per km); 9.6(size) -> 7100(weight), 4.81(cost per km); 15(size) -> 12000(weight), 6.34(cost per km);
Suppose all routes has 3 number of transit times to reach the destination, then:
transit cost of each route = transit times*order quantity allocated to this route*4.5
Suppose transport cost of route is based on number of trucks used and the travling distance, then:
transport cost of each route = number of trucks allocated to this route*route distance
x[j] -> 0-1 variables, if route x1,x2,x3....xj is used. a[i][j] -> is the weight proportion of order i allocated to route j t[j][s] -> truck number of certain size needed for each routes
Min (total tranpsort cost + total transit cost) -> MinΣ(x[j]*t[j][s]*Distance[j]*Cost[j] + x[j]*a[i][j]*OrderQuantity[i]*TransitTimes
1. if a[i][j] is the proportion of weight allocation among the feasible routes of an order, then: a1+a2+a3 = 1 2. orders combined together must choose the same route 3. orders combined together must be the same route type 4. all orders must be allocated to one or more trucks and shipped 5. the chosen of the truck size must be within the truck options for each route 6. total weight loaded on the truck must not exceed the total capacity of the truck
This is the CSV formate of the input data:
OrderID,Order_Category,Quantity,Weight,Route1,Route1_Distance,Route1_Type,Route1_TruckOption,Route2,Route2_Distance,Route2_Type,Route2_TruckOption,Route3,Route3_Distance,Route3_Type,Route3_TruckOption 1,B,2000,4000,010W,2000,1,13.5-15,010WE,1750,1,13.5-15,022X,2200,1,13.5-15 2,B,4000,8000,010W,2000,1,13.5-15,010WE,1750,1,13.5-15,022X,2200,1,13.5-15 3,B,1000,2000,010W,2000,1,13.5-15,010WE,1750,1,13.5-15,022X,2200,1,13.5-15 4,B,3500,7000,010WE,1750,1,13.5-15,022X,2200,1,13.5-15,,,, 5,B,2500,5000,020WB,2100,1,13.5-15,022X,2200,1,13.5-15,,,, 6,B,2500,5000,311W,1500,1,13.5-15,022X,2200,1,13.5-15,,,, 7,B,1000,2000,755WF,3500,2,7.6-9.6,755WE,3300,2,7.6-9.6,,,, 8,C,1000,2000,471W,3200,1,13.5-15,010WE,1750,1,13.5-15,022X,2200,1,13.5-15 9,C,1500,3000,471W,3200,1,13.5-15,010WE,1750,1,13.5-15,022X,2200,1,13.5-15 10,C,2000,4000,769WX,2750,2,7.6-9.6,663WA,2600,2,7.6-9.6,,,, 11,C,1000,2000,769WX,2750,2,7.6-9.6,754W,2900,2,7.6-9.6,663WA,2600,2,7.6-9.6 12,C,2000,4000,769WX,2750,2,7.6-9.6,755WE,3100,2,7.6-9.6,,,,
The optimization result might look like this:
My questions: I am not sure how to write the constraints 2,3,5,6. In particular, I have no idea to:
1). model the connection between the weight allocated to a route and the associated truck size and quantity needed for the same route (i.e. how to write the objective function properly to represent the total transport cost); 2). make sure orders combined using the same route and same route type
An MIP code example using Google OR tools or Gurobi python would be helpful.