9.6 Where Conditions on Formula Terms

Sometimes it is necessary to make a term formula, or a certain constraint, dependent on the data. MPL offers a feature called the WHERE condition, which means that certain parts of the model are included only where a condition on the data is met.

For example, assume that you have a datavector A[i,j] filled with sparse data and you only want the following constraint where the values are greater than zero. You would write:

   constr[i,j] WHERE (A[i,j] > 0.0) : ...

The same rule applies when you want to use the WHERE condition on formula terms:

   + x[i] EXCEPT WHERE (b[i] = 1.0) + ...

In this example the variable x[i] is used wherever b[i] is not equal to one. The EXCEPT keyword inverts the set of values.


Back To Top | Maximal Home Page | Table of Contents | Previous Page | Next Page