I have two tuples like this:
tuple Combination_L {
int rooms;
int instructors;
int studentgroups;
int courses;
};
{Combination_L} L = ...;
tuple Combination_T {
int days;
int slots;
};
{Combination_T} T = ...;
So, I want to combine Tuples L and T to initialize the Tuple V. And this Tuple Vl must be:
tuple Combination_L_T{
int rooms;
int days;
int slots;
int instructors;
int studentgroups;
int courses;
};
{Combination_L_T} Vl = {};
execute {
for (var p in L){
for (var q in T){
Vl.add(<p.rooms,
q.days,
q.slots,
p.instructors,
p.studentgroups,
p.courses>);
};
};
};
So, I become a error warning "missing expression" by Vl.add. Could you tell me please, how could I fix this error?. Thanks all!
In the scripting part your should not use <> for tuples.
The following model works fine:
tuple Combination_L {
int rooms;
int instructors;
int studentgroups;
int courses;
};
{Combination_L} L = {<1,2,3,4>,<2,3,4,5>};
tuple Combination_T {
int days;
int slots;
};
{Combination_T} T = {<10,11>,<12,13>};
tuple Combination_L_T{
int rooms;
int days;
int slots;
int instructors;
int studentgroups;
int courses;
};
{Combination_L_T} Vl = {};
execute {
for (var p in L){
for (var q in T){
Vl.add(p.rooms,
q.days,
q.slots,
p.instructors,
p.studentgroups,
p.courses);
};
};
};
NB:
As can be seen at https://github.com/AlexFleischerParis/howtowithopl/blob/master/cartesianproduct2.mod you can do that product in the modeling part too