CPLEX; Mixed Integer Linear Programming; Constraint Formulation:
There are 150 towns in the dataset, each town having several markets (or "mandis"). Total number of mandis in the dataset = 1800. I have a binary decision variable y[mandi][days]. I want to add a constraint which states that y[mandi][days] is equal for all mandis within any given town on any given day. y[mandi][days] could be different/same for the mandis in different towns on the same day.
I'm inputting the data from Excel. Please see the attached image. Can you help me out with how to formulate this constraint in OPL?
One way to achieve the above is to specify individual constraints on the set of mandis within each town. However, the number of constraints, in that case, would become 150, each referring to one town. Also, we might receive from the client an additional list of mandis for some towns, which would distort the mandi-town mapping numbering, and I would have to change the mapping in CPLEX again. Is there a better way to do this, which could take the mapping directly from excel in the attached image format?