Getting non trivial solution from homogeneous system of equation
回答済みHello,
I am solving a MILP problem. However, one of the constraints requires a homogeneous system of linear equation.

for H is a non-invertible 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 non-trivial solution?
Thank you.
-
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
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
投稿コメントは受け付けていません。
コメント
3件のコメント