I have a general question regarding the computational efficiency of two alternative methods of formulating a constraint in mosel.
Say I have an array of mpvars X(t). Each element of the array has its own coefficient C(t). I have a constraint:
constraint:= sum(t in TSET) C(t)*X(t) <= Z where Z is a constant.
The coefficients C(t) are specified as a conditional sum of one or more other data arrays - e.g.
C(t) := sum( a in A, b in B | t in MAP(a) ) E1(a) + E2(a,b)
An alternative to this structure is to formulate everything directly within the constraint:
constraint:= sum( a in A, b in B, t in MAP(a) ) (E1(a) + E2(a,b) ) * X(t) <= Z
My question is: does anyone know in general which approach is the most efficient for mosel - i.e. which will take the least execution time to prepare the model for sending to the solver? The first approach is perhaps best for readability, but if I have a large data set that would require the calculation of a large number of very large "derived" coefficient arrays, would I be able to reduce execution time significantly by formulating directly within the constraints and not creating the derived or intermediate arrays? Of course, all this is depends on how large is large, but any indications on this front would be welcome!