The error message somehow did not get pasted, but I think I understand what you want to do.
Suppose the original variable declarations were as follows, with bounds and INIT omitted for simplicity:
var FFS1C {MYSET1};
var FFS2C {MYSET2};
var FFSSC {MYSET3};
var FFPKC {MYSET4};
var FFTPC {MYSET5};
If your constraint is as follows, you will get an error if <p,k,t> is not in each variable's index set:
con CTPC {<p,k,t> in ixFFTP} :
FFS1C[p,k,t] + FFS2C[p,k,t] + FFTSC[p,k,t] + FFPKC[p,k,t]
= FFTPC[p,k,t];
One way to avoid the error is to enlarge each variable's index set to be ixFFTP and then force the unwanted variables to 0 (either with an explicit constraint or via the FIX statement), as you did.
A simpler and more efficient approach is to use IF-THEN expressions like this:
con CTPC {<p,k,t> in ixFFTP} :
(if <p,k,t> in MYSET1 then FFS1C[p,k,t])
+ (if <p,k,t> in MYSET2 then FFS2C[p,k,t])
+ (if <p,k,t> in MYSET3 then FFTSC[p,k,t])
+ (if <p,k,t> in MYSET4 then FFPKC[p,k,t])
= (if <p,k,t> in MYSET5 then FFTPC[p,k,t]);
That way, you can keep the original variable declarations, and each variable appears in the constraint only if the tuple is in that variable's index set.
... View more