I think I need some help with the OPL language :/ My code is the following:
using CP;
int NbMchs = ...;
range Mchs = 0..NbMchs-1;
tuple Mode {
int opId;
int mch;
int pt;
};
{Mode} Modes = ...;
// Not Working...
int test[m in Mchs] = all(md in Modes: md.mch == m) md.opId;
What I want to do is to extract m 1D arrays from the Modes
structure containing just the opId field of the tuple. Each test[m]
array has to contain it's corresponding elements: that is the opId field of the tuple md
where md.mch =m
.
The error that I get from the above code is "Cannot use type int[] for int". It seems like the right hand side of the above function is returning a single integer, but I was thinking that the all()
operator is the one that I can use to do the job.
Thanks in advance