Skip to content

Commit

Permalink
resize Q and A after presolve (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffroyleconte authored Aug 18, 2022
1 parent 711111e commit 3fa3e7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/presolve/presolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ function presolve(
end

if !isempty(operations)
remove_rowscols_A_H!(psdata.A, psdata.H, qmp)
nconps, nvarps = update_vectors!(qmp)
remove_rowscols_A_H!(psdata.A, psdata.H, qmp, nvarps, nconps)
psdata.c0 = qmp.c0
end

Expand Down
4 changes: 3 additions & 1 deletion src/presolve/presolve_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ end
find_empty_rowscols(v_cnt::Vector{Int}) = findall(isequal(0), v_cnt)
find_singleton_rowscols(v_cnt::Vector{Int}) = findall(isequal(1), v_cnt)

function remove_rowscols_A_H!(A, H, qmp::QuadraticModelPresolveData)
function remove_rowscols_A_H!(A, H, qmp::QuadraticModelPresolveData, nvarps, nconps)
Arows, Acols, Avals = A.rows, A.cols, A.vals
Hrows, Hcols, Hvals = H.rows, H.cols, H.vals
kept_rows, kept_cols = qmp.kept_rows, qmp.kept_cols
Expand Down Expand Up @@ -118,6 +118,8 @@ function remove_rowscols_A_H!(A, H, qmp::QuadraticModelPresolveData)
resize!(Hcols, Hnnz)
resize!(Hvals, Hnnz)
end
A.m, A.n = nconps, nvarps
H.m, H.n = nvarps, nvarps
end

function update_vectors!(qmp::QuadraticModelPresolveData)
Expand Down

0 comments on commit 3fa3e7b

Please sign in to comment.