2
$\begingroup$

So I have the following matrix:

\begin{equation} P_{i,j}= \begin{bmatrix} x_0 & x_1 & x_2 \\ y_0 & y_1 & y_2 \\ z_0 & z_1 & z_2 \end{bmatrix} \end{equation}

where each of the elements in the matrix are binary variables (can be either 0 or 1). I am solving an optimization problem where I want to impose a constraint where each of the rows of the matrix have to have $n$ number of zeros. So for example, for the first row of matrix $P$ (containing the $x_i$ elements), I want to enfore that for this row, I want one of these $x_i$'s to be zero (but not explicitly stating which one should be zero). As a second example, for the second row of matrix $P$ (containing the $y_i$ elements), I want to enfore that for this row, I want two of these $y_i$'s to be zero (but not explicitly stating which ones should be zero). And so fourth...

Is there a way to make this kind of formulation? I was thinking of imposing the constraints as follows:

$\sum_j P_{1,j} = 2$

$\sum_j P_{2,j} = 1$

Would this be the correct approach?

Your help would be much appreciated!

$\endgroup$
0
3
$\begingroup$

Set boolean=True for the matrix variable P, and use the constraints you have proposed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.