How to add global constraints

Can we define constraints such as to restrict the number of route produced ?

I don’t think it can be implemented using HardRouteConstraint or HardActivityConstraint.

You can restrict number of routes by restricting number of vehicles. I’m not sure about general hard constraint. That is something I’m planning to work on.

Hi @shivkrishnajaiswal and @Bhoumik_Shah,

I think you can do it using a hard route constraint (and a state updater). Please check out the following two commits:

I think it is practically useful for the case where you have X vehicles but you would like to use only Y of them.

Hopefully it works well for your case.

Best regards,