Getting non trivial solution from homogeneous system of equation
AnsweredHello,
I am solving a MILP problem. However, one of the constraints requires a homogeneous system of linear equation.
for H is a noninvertible matrix, q and x are vectors (lists), M is sufficiently large and epsilon is sufficiently small.
I already wrote the codes in Python as below:
And I got this result:
I could get the result for x, but I want to avoid the trivial solution for q. Both variables are dependent to each other, so although the trivial solution is natural, there are still more options to get other values for q. Is there anyway to go around the constraints to get nontrivial solution?
Thank you.

Hi Regina,
By default, variables added using Model.addVars() are nonnegative. Perhaps this is the problem, since the solution to the system \( Hq = 0 \) is restricted to the set \( \{ q \colon q \geq 0 \} \). You can remove the lower bound on the \( q \) variables by adding \( \texttt{lb=GRB.INFINITY} \) as a keyword argument to Model.addVars(). Could you try this?
Also, note that you can use \( \texttt{x.sum()} \) to generate the objective function \( \sum_{i \in E} x_i \). This is a bit more concise. See tupledict.sum() for more information about this method.
Thanks,
Eli
0 
Hi Eli,
I tried your solution and it works just as I expected. Thank you very much!
Kind regards,
Regina
0
Please sign in to leave a comment.
Comments
2 comments