I habe the code like this:
tuple Variableset{
int rooms;
int days;
int slots;
int instructors;
int groups;
int courses;
}
{Variableset} A = ...;
tuple Solution{
int days;
int slots;
int instructors;
}
{Solution} B = ...;
{Variableset} C;
execute {
for (var s in B)
for (var item in A){
if (item.days == s.days && item.slots == s.slots
&& item.instructors == s.instructors) {
C == A.remove(item);
};
};
};
};
I'm trying to create a new tuple set C by removing the tuples in A whose elements of B are the same as those of A. I know my code isn't quite right, I'd love some help to fix it. Thanks in advance!
Scripting is powerful but you do not need scripting in this. You can do that in modeling:
tuple Variableset{
int rooms;
int days;
int slots;
int instructors;
int groups;
int courses;
}
{Variableset} A = {<1,2,3,4,5,6>,<2,3,4,5,6,7>};
tuple Solution{
int days;
int slots;
int instructors;
}
{Solution} B = {<3,4,5>};
{Variableset} C={<a,b,c,d,e,f> | <a,b,c,d,e,f> in A : <b,c,d> not in B};
execute
{
writeln(C);
}
which gives
{<1 2 3 4 5 6>}