Hi @Grzegorz ,
Firstly you need a state updater to memorize the number of locations each route visits. Then you need a route constraint to disallow an insertion if the route already visits N locations (the limit) and the job introduces a new one. Whether the constraint is a hard one or a soft one depends on your need.
Hopefully the above helps.