By deeply exploring the mailing lists i now know this is not possible.
I’ll describe the full problem below, describe my theoretical solution and seek for suggestions.
(I’m considering to change the topic title in something more related to the actual problem)
I have clients (gas stations) spread among a certain region.
1- Clients will place orders and order different quantity of 6 possible products p1,p2,p3,p4,p5,p6 ( p1,p2,p3,p4 being different diesel types, p5,p6 different gasoline types)
2- To fulfill the orders i have 4 depos (A,B,C,D) each with a number of vehicles, let’s say 3 vehicles for each depo.
3- Not all depos can serve all products. For example depo A can only serve p1,p2,p4.
4- Vehicles can load the products from any depo, but by the end of the day they must return to their own depo. They can do multiple trips.
5- Vehicles are all different and have the following types of constraints.
Some vehicles can’t load at some depo. Let’s say vehicle v1 can’t load at depo B, but can load at A,C,D.
6- (Important: The product compartmentation problem)
Vehicles have 2 or 3 tanks with their own capacity.For example v2 has three tanks witch has the following capacities tank1 : 2000 liters, tank2 : 1500 liters, tank3 : 4000 liters.
Tanks are not product specific. For example i can put p1 in tank1, p1 in tank2 and p5 in tank3, but i can put p5 in tank1, p1 in tank2 and p1 in tank3.
Not all vehicles can carry all products. Only some vehicles can carry the gasoline type products(p5,p6), but all vehicles can carry the diesl type products (p1,p2,p3,p4)
In addition if a vehicle can carry the gasoline type products, it can carry it on any of the tanks, but once carried a gasoline type product it cannot carry another gasoline type product, only diesel type products.
Basicly p5 and p6 can’t be in the same vehicle.
Obviously none of the products can be mixed.
My proposed solutions are basically two:
a- Fork jsprit to allow more pickup locations for shipment.
Implement the product compartmentation somehow…
b- Consider all possible shipments and then put a constraint that only one will be considered.
Consider all possible compartmentations and add a vehicle for every compartmentation and then put a constraint that only one will be considered.
I’m not too confident to choose the first solution so i think i’ll pick the second one, having the downside of introducing some randomness (hoping not too much).
The following is a theoretical solutions to the above problem points
1- Split the orders into more orders, each one containing only one type of product.
So if a client placed an order containing 1000 of p1 and 2000 of p5, i’ll split this order in two orders, the first having 1000 of p1 and the second having 2000 of p5
2,3,5- Model orders as shipments having as pickup location any possible depo. In this phase i will filter out the depos that don’t serve a particular product by not creating that shipment. In the shipment i’ll put the required skill “depo_name”. This way if a vehicle can’t access the depo won’t have the “depo_name” skill.
If i consider having 100 orders (shipments) * 4 depos = 400 shipments
4- setReturnToDepot(true) should resolve this.
6- Calculate all the possible compartmentations a vehicle can have and add them as different vehicles. For example if a vehicle v3 has two tanks (with 1000 and 3000 liters of capacity) and can carry gasoline products i’ll create the following vehicles:
v3-1 with .addCapacityDimension(p1_index, 1000).addCapacityDimension(p1_index, 3000). This means that this vehicle can only carry p1 on both tanks
v3-2 with .addCapacityDimension(p1_index, 1000).addCapacityDimension(p2_index, 3000). This means that this vehicle can only carry p1 on the first tank and p2 on the second tank.
v3-n with .addCapacityDimension(pn_index, 1000).addCapacityDimension(pm_index, 3000). This means that this vehicle can only carry pn on the first tank and pm on the second tank.
This way i resolve the problem that a vehicle can’t carry gasoline products at all (because i’ll not generate that kind of vehicle) and the problem that if it can carry gasoline products it will not be able to carry two of them (because i’ll not generate that kind of vehicle).
If i consider the medium number of compartmentations for vehicle (some have more, some have less) around 25 and consider having 10 vehicles * 25 = 250 vehicles
I think this resolves the product compartmentation problem.
What do you think?
Is this the right way to proceed or am i missing something?