Restrict back to back same location job

Hi @sutirtha_kayal,

I haven’t tried out your implemented constraint, but I think a possible reason could be that the ruin phase breaks the constraint.

Your constraint controls the insertion phase and makes sure that (if all jobs are to be inserted, e.g., when building initial solution) AAB is not allowed (A and B indicate locations) while ABA is. However, in the ruin phase, it is possible that the B is ruined from ABA and it leaves AA for the insertion phase, which then inserts B after the second A so that cost is minimized and results in a sequence of AAB. Thus in the final solution your constraint is broken.

Some related posts can be found here:

Best regards,
He