I have an optimization problem that has a constraint

x_m=\sum_{n=1}^Nb_{n,m}c_{n,m}d_{n,m},m=1,2,\cdots,M

Here, b_{n,m} is a binary variable and c_{n,m} is a continuous variable

d_{n,m} are given.

I linearize the multiplication of binary and continuous variable b_{n,m}c_{n,m} by introducing a new variable p_{n,m}=b_{n,m}c_{n,m} and then adding the follwing linear constraints

(i) p_{n,m}\le b_{n,m}

(ii) p_{n,m}\ge 0

(iii) p_{n,m}\le c_{n,m}

(iv) p_{n,m}\ge c_{n,m}-(1-b_{n,m})

since c_{n,m} is lower and upper bounded by 0 and 1, respectively.

ISSUE:

I have other constraint as

\sum_{n=1}^Nb_{n,m}\le 2, m=1,2, \cdots,M

and

\sum_{m=1}^Mc_{n,m}\le 1, n=1,2, \cdots,N

I expected that after we solve the problem, if the output p_{n,m}>0, I have b_{n,m}=1, but this is not the case. I have noticed that for some p_{n,m}>0, I have b_{n,m}=0 or vice versa. The same goes for c_{n,m}.

Why is that happening and how can I fix this?