Hello all,
I am using a distance matrix in my optimization model. There are plants and
customers. The whole data set is something like the following:
Cust ACust BCust CCust DPlant A23344256Plant B1343241433Plant C86986545
However, when I read data, I only use the distance values (not the column
or row headers; i.e Cust 1, Cust 2 is not there) in my excel input file:
23344256134324143386986545
I refer to those distances by using consecutive numbers(namely 1 for Plant
A, 2 for Plant B etc. Same for Cust A to D). For example d[2,1] is 134.
That way, I can include a subset of them in my constraints. An example
constraint
for i in I1
@addConstraint(m, Y[i,j]==sum{a*d[i,j], c in C1})
end
where ( I1=[2, 3], C1=[1, 4] ).
Is there a way to refer to these distance values by using column and row
headers/titles? In other words, can I have I1=[Plant B, Plant C], C1=[Cust
A, Cust D] instead of their corresponding numbers ( I1=[2, 3], C1=[1, 4] )?
How should I read input file for distances so that it finds distances by
checking column and row headers rather than checking by row and column
coordinates/numbers?
I really appreciate if you can give some ideas.
Thank you.