Originally posted by: DouglasC
Hello
I have a set declared as follows.
{string} team_names =...;
The data is then read from a spreadsheet. All this works okay, as I can see the data if I set a breakpoint.
I want to display this data once I have set the decision variables (Fixs[i][j][k]). To do this I have the following execute code.
execute
{
for(k in Days)
{
for(i in nRows_and_nCols)
{
for(j in nRows_and_nCols)
{
if(Fixs[i][j][k] == 1)
{ writeln(team_names[i],
",", team_names[j],
",", distance[i][j]);
// THIS DOES NOT WORK
}
// if(Fixs)
}
// for j
}
// for i
}
// for k
}
// execute
I want to iterate over the decision variables and, if set, then display the i'th and j'th elements of team_names, but I can't see how to do it.
I have tried to create an index to num_teams, but can't get it to work (either an error at complie or run time or the values come out as "Undefined").
In my naive mind I just want to create a couple of counters (say var i_cnt = 0; j_cnt =0;), increment them (e.g. i_cnt++) as I loop through i,j,k and then use them as an index to team_names when necessary.
I realise (believe anyway) that this is a real newbie questiosn but it has been driving me nuts for hours.
Any help appreciated.
Doug
#DecisionOptimization#OPLusingCPLEXOptimizer