Hi,

I'm new to Xpress and I am trying to run a model for my thesis.

However, I do not how to formulate the following:

I want to get output, that gives the solution of y(i), only if that y has a value of 1. (y(i) is binary)

Currently I state: forall(i in PP) writeln("y(", i, ") : ", getsol(y(i))) and I get a list of e.g. y(1) =1, y(2) = 1, y(3)=0, but I want Xpress to provide only the y(i) that have a value of 1.

I have tried several things (if loop etc), but Xpress gives errors that I do not understand.

How would you normally formulate such an request?

Thanks in advance!

Annemiek Peters

In the test on the loop index you need to check the solution value (NB: the notations ".sol" and "getsol" for an mpvar are equivalent):

forall(i in PP | y(i).sol = 1) writeln("y(", i, ") : ", getsol(y(i)))