Originally posted by: Striker121
Hi there,
I run CPLEX version 12.7.0.0.
I have difficulty in modelling the following constraint in CPLEX:
where Phi is the empty/null set.
More specifically, the part stating that the union of both sets Ris and Ri's' must not equal the null/empty set. CPLEX returns the following error: "Operator not available for {int} != {void}". I have searched to find an analog of the operator "!=" for sets but I have no luck in both the forum and documentation. I would greatly appreciate any help in modelling this constraint. I have attached my .mod file and .dat file as well as the accompanying Excel spreadsheet to this post. I will also copy paste it below.
Thanks in advance!
.mod file:
int nbBatchesI = ...;
int nbStagesS = ...;
range BatchI= 1..nbBatchesI;
range StagesS= 1..nbStagesS;
//The following strings are used to extract the data from the Excel sheets
string stS[BatchI] = ...;
string stRis[BatchI][StagesS] = ...;
{int} S[BatchI];//Set Si
{int} Ris[BatchI][StagesS];
//Parameters
int H=200;
//Continuous Decision Variables
dvar float C[BatchI][StagesS];
dvar float Start[BatchI][StagesS];//Is the variable Sis in the equation
//Binary Decision Variables
dvar boolean W[BatchI][StagesS][BatchI][StagesS];
execute convert_strings
{
for(var b in BatchI)
{
var ar=stS[b].split(",");
for(var i=0;i<ar.length;i++) S[b].add(Opl.intValue(ar[i]));
}
}
execute convert_strings_Obtain_Ris
{
for(var b in BatchI)
{
for(var s in StagesS)
{
var ar=stRis[b][s].split(",");
for(var i=0;i<ar.length;i++) Ris[b][s].add(Opl.intValue(ar[i]));
}
}
}
subject to {
//A lot of other constraints before this
forall (i in BatchI, ip in BatchI, s in S[i], sp in S[ip] : ( (Ris[i][s] union Ris[ip][sp] != {}) && (ip != i) ))
ResourceOverlapConstraint13:
C[ip][sp] - Start[i][s] <= H*W[ip][sp][i][s];
}
Also my .dat file
nbBatchesI = 3;
nbStagesS = 3;
SheetConnection Example_Data ("ExampleDataTEST.xls");
stS from SheetRead(Example_Data, "'Si'!A1:C1");
stRis from SheetRead(Example_Data, "'Ris'!A1:C3");
#DecisionOptimization#OPLusingCPLEXOptimizer