I would like to implement something similar and I was wondering if now there is a better or easier suggestion for doing so?
The constraint that I want to impose is that a route shouldn’t be acceptable if the total number of deliveries and pickups is less than a given value. The fleet that I want to use is finite and the acceptable solution would be less vehicles used but with enough deliveries and pickups.
I have thought the following which is different from your suggestions.
First, I have implemented SolutionCostCalculator which checks for the number of activities per route for the given solution and if the condition isn’t met then an extra cost is introduced. With that I try to achieve that solutions honoring the constraint will be picked.
Then, when the algorithm ends I check again if the found solutions honor the condition and if not I re-run the algorithm but I set the number of the vehicles to one less, until I find an acceptable solution.
However, I am not very satisfied from the above process and I was wondering if I should stop pursuing this and trying some other approach. What do you think?
Thanks in advance!
Update: I tried using a SolutionAcceptor instead of a SolutionCostCalculator and I find the results more satisfying. However, any suggestions or comments are more than welcome!