-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highs::getRows has linear scaling before a solve #2114
Comments
The row-extraction method was written when there was only ever a column-wise representation of the matrix, and its first action is to ensure that the representation is column-wise. It's not hard to implement the row-wise extraction (and the column-wise extraction that isn't implemented when the matrix is held row-wise). |
Cool cool. Fixing this would speed up @jd-lara's Sienna models by a lot because he has a sanity check that loops through each constraint to check for malformed data etc, and querying the rows was a significant portion of the total runtime. (He can't as easily do the check as each constraint is being built because not all data is available yet. He could also store a copy of the data in a different data structure to do the check more efficiently, but then we need 2x the memory requirements.) |
If you look at jump-dev/HiGHS.jl#207 (comment) vis a vis Gurobi, the larger examples should run in milliseconds, not seconds. |
I was passing the matrix down to the new code by value, not reference! I get linear time for your C code |
See jump-dev/HiGHS.jl#207
JuMP really likes to build and operate on rows, not columns. Querying the constraint function is a somewhat common operation, and it happens one-by-one; users don't have access to query a range of constraints in a single go.
This code in C shows what we'd like to do:
In theory this should have
O(N)
scaling. But it hasO(N^2)
. DoubleN
and the runtime increase by a factor of 4:Since we're iterating over every constraint, I think this means that each call to
getRows
is iterating over the entire constraint matrix.This could be acceptable after
Highs_run
when HiGHS has stored the constraint matrix in column-major order, but so far all we have done is add rows one-by-one, so things should still be in row-major order.The text was updated successfully, but these errors were encountered: