If I understand correctly, FF is a subset of Fields cross Feedstock. Here is a "dense" approach that treats a[i,f,p] as 0 for <i,f> pairs that do not appear in FF:
num aifp {Fields,Feedstock,Price} init 0;
read data ORout.supply into [fips Feedstock]
{p in Price} < aifp[fips, Feedstock, p] = col ("Pr"||p) >;
var Assign{Fields, Depots, Feedstock, Price} binary;
var Amount{Fields, Depots, Feedstock, Price} integer >= 0;
con Supply_constraints{i in Fields, j in Depots, f in Feedstock, p in Price}:
Amount[i,j,f,p] <= aifp[i,f,p]* Assign[i,j,f,p];
con Dry_Matter {j in Depots, f in Feedstock, p in Price}:
sum{i in Fields}(1-mf[f])*aifp[i,f,p] = sum{i in Fields} Amount [i,j,f,p];
Alternatively, here is a more efficient "sparse" approach, as in the Sparse Modeling documentation example:
num aifp {FF,Price} init 0;
read data ORout.supply into FF = [fips Feedstock]
{p in Price} < aifp[fips, Feedstock, p] = col ("Pr"||p) >;
var Assign{FF, Depots, Price} binary;
var Amount{FF, Depots, Price} integer >= 0;
con Supply_constraints{<i,f> in FF, j in Depots, p in Price}:
Amount[i,f,j,p] <= aifp[i,f,p]* Assign[i,f,j,p];
con Dry_Matter {j in Depots, f in Feedstock, p in Price}:
sum{<i,(f)> in FF}(1-mf[f])*aifp[i,f,p] = sum{<i,(f)> in FF} Amount [i,f,j,p];
Note the difference in order of indices for both Assign and Amount, with i,f,j,p instead of i,j,f,p.
... View more