Multiple submatrices
回答済みI am interested in solving several hundred problems of form
minimize c' x
subject to Ax ≤ b
where each A is column-submatrix of a larger matrix. Re-writing the input file for each program file seems inefficient. Does Gurobi have a native solution for this? Specifically, functionality that would allow me to specify a single matrix M, and then a sequence of indices [ [a1, ..., am], [b1, ..., bn], ... ] so that Gurobi first soles a problem of form
minimize c[ a1,...,am]' x[ a1,...,am]
subject to M[ :, a1,...,am] x ≤ b
and so on?
I know there's functionality to solve multiple problems with different values for c and b, and in principle I think one could modify the program so that certain entries of x can be forced to take a value of zero by manipulating upper bounds [this would eliminate the need to modify A], but I don't understand the internal workings of Gurobi well enough to have a clear guess at the impact this would have on performance. Thanks!
-
正式なコメント
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 try Gurobot, our chatbot interface offering instant, expert-level support. -
I see two ways of approaching your issue.
1. You could use Gurobi's Matrix API. This way, you could define a matrix A holding all columns and quickly rebuild your model using sub-parts of this matrix. The same would hold for c,b, and x.
2. You construct the big model holding all columns and rows. You can turn off a column by setting both bounds of a given variable to \(0\) via
x.LB=0
x.UB=0You can turn off a constraint via setting it's right hand side to \(\texttt{GRB.INFINITY}\) via
con.RHS=GRB.INFINITY
See documentation of attributes for mode details.
You would have to reset variable bounds and right hand sides in between two optimization runs but you would not have to rebuild the model.
Best regards,
Jaromił0
投稿コメントは受け付けていません。
コメント
2件のコメント