Hi,
.mod
{string} Commodities = ...;
{string} Modes = ...;
tuple link
{
string k;
string m;
string i;
string j;
}
{link} Links=...;
tuple
arcs
{
string i;
string j;
}
{
arcs} Arcs= {<i,j> | <k,m,i,j> in Links};
int Cost[Commodities][Modes][Arcs] =...;
int costA=Cost["first"]["truck"][<"one","three">];
execute
{
writeln(costA);
}
.dat
Commodities = {first second};
Modes = { truck, train};
Links = {
<first,truck,one,two>
<first,truck,one,three>
<first,truck,three,four>
<first,truck,four,two>
<second,truck,three,four>
<second,truck,five,three>
<second,truck,four,six>
<second,truck,five,six>
<first,train,one,two>
<first,train,one,three>
<first,train,three,four>
<first,train,four,two>
<second,train,three,four>
<second,train,five,three>
<second,train,four,six>
<second,train,five,six>
};
Cost=[[[1,2,3,4,5,6][11,2,3,4,5,6]][[1,2,34,4,5,6]]];
works fine
If you find this difficult, you could write cost in a tuple set with the "#" way:
tuple point
{
int x;
int y;
}
point p1=...;
point p2=...;
In the .dat file, you write:
p1=#<y:1,x:2>#;
p2=<2,1>;
regards
#DecisionOptimization#OPLusingCPLEXOptimizer