I am dealing with an optimization problem that involves the rank of a matrix as a hard constraint. I am starting with this simple example
`NMinimize[{a12, MatrixRank[{{a11, a12}, {2, 4}}] == 1 && a11 >= 1}, {a11, a12}]`
That is a 2x2 matrix {{a11, a12}, {2, 4}}
of which the first row is undetermined and I want to put a rank of 1 as a hard constraint. With another constraint, a11>=1
, the answer would be a12=2
. However, it gives the following information
NMinimize::nsol: There are no points that satisfy the constraints {False}.
But the thing is, it seems that whenever evaluated in Mathematica with symbols, the command MatrixRank[{{a11, a12}, {2, 4}}]
always gives 2 as an answer. Is there a way that can evaluate MatrixRank[{{a11, a12}, {2, 4}}]
numerically inside the NMinimize
function and solve the problem above?
As some people may point out, calculating the determinant can be an alternative. The reason that I prefer to use MatrixRank
is that actually, the matrices I am dealing with can be rectangular as well. Even if it is nxn
square, I may require its rank to be n-2
.