I have a binary assignment problem that I want to find the maximum value of using glpsol.
The solution is easily (i.e. quickly) found and I can print using:
printf{i in I} "%d ", x[i];
(if it does matter: x[i] is an array of variables defined like this var x{i in I}, >= 0;
)
Since I expect each variable to be binary the above statement returns a list of 0s and 1s, which is fine.
A strange thing happens when I output the very same solution using:
display {i in I} x[i];
This way I get values that are not binary (0.5 to be precise).
Why is this happening?
Can I output (just) a solution obtained using printf
to a file ? (--output
returns the values same as display
)