Skip to content

Commit 0f75afe

Browse files
coo
1 parent 487d219 commit 0f75afe

File tree

7 files changed

+134
-101
lines changed

7 files changed

+134
-101
lines changed

Manifest.toml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
[[ExprTools]]
4+
git-tree-sha1 = "b7e3d17636b348f005f11040025ae8c6f645fe92"
5+
uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
6+
version = "0.1.6"
7+
8+
[[FastClosures]]
9+
git-tree-sha1 = "acebe244d53ee1b461970f8910c235b259e772ef"
10+
uuid = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
11+
version = "0.3.2"
12+
13+
[[Libdl]]
14+
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
15+
16+
[[LinearAlgebra]]
17+
deps = ["Libdl"]
18+
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
19+
20+
[[LinearOperators]]
21+
deps = ["FastClosures", "LinearAlgebra", "Printf", "SparseArrays", "TimerOutputs"]
22+
git-tree-sha1 = "b1c44338ae57f6e561b1df85240ced65404508a5"
23+
uuid = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
24+
version = "2.2.2"
25+
26+
[[NLPModels]]
27+
deps = ["FastClosures", "LinearAlgebra", "LinearOperators", "Printf", "SparseArrays"]
28+
git-tree-sha1 = "e17945150641249d1658637e4faf71a049067d73"
29+
uuid = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
30+
version = "0.17.2"
31+
32+
[[NLPModelsModifiers]]
33+
deps = ["FastClosures", "LinearAlgebra", "LinearOperators", "NLPModels", "Printf", "SparseArrays"]
34+
git-tree-sha1 = "705d402d1fe1837f0c07dd1d7b137b390fb764c5"
35+
uuid = "e01155f1-5c6f-4375-a9d8-616dd036575f"
36+
version = "0.4.3"
37+
38+
[[Printf]]
39+
deps = ["Unicode"]
40+
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
41+
42+
[[Random]]
43+
deps = ["Serialization"]
44+
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
45+
46+
[[Requires]]
47+
deps = ["UUIDs"]
48+
git-tree-sha1 = "4036a3bd08ac7e968e27c203d45f5fff15020621"
49+
uuid = "ae029012-a4dd-5104-9daa-d747884805df"
50+
version = "1.1.3"
51+
52+
[[SHA]]
53+
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
54+
55+
[[Serialization]]
56+
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
57+
58+
[[SparseArrays]]
59+
deps = ["LinearAlgebra", "Random"]
60+
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
61+
62+
[[TimerOutputs]]
63+
deps = ["ExprTools", "Printf"]
64+
git-tree-sha1 = "7cb456f358e8f9d102a8b25e8dfedf58fa5689bc"
65+
uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
66+
version = "0.5.13"
67+
68+
[[UUIDs]]
69+
deps = ["Random", "SHA"]
70+
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
71+
72+
[[Unicode]]
73+
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
1010
NLPModelsModifiers = "e01155f1-5c6f-4375-a9d8-616dd036575f"
1111
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1212
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
13+
SparseMatricesCOO = "fa32481b-f100-4b48-8dc8-c62f61b13870"
1314

1415
[compat]
1516
LinearOperators = "2.2.2"

src/QuadraticModels.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module QuadraticModels
44
using LinearAlgebra, SparseArrays
55

66
# our packages
7-
using LinearOperators, NLPModels, NLPModelsModifiers
7+
using LinearOperators, NLPModels, NLPModelsModifiers, SparseMatricesCOO
88

99
# auxiliary packages
1010
using Requires

src/presolve/presolve.jl

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
include("remove_ifix.jl")
22

3-
mutable struct PresolvedQuadraticModel{T, S, D <: AbstractQPData{T, S}} <:
4-
AbstractQuadraticModel{T, S}
3+
mutable struct PresolvedQuadraticModel{T, S, M1, M2} <: AbstractQuadraticModel{T, S}
54
meta::NLPModelMeta{T, S}
65
counters::Counters
7-
data::D
6+
data::QPData{T, S, M1, M2}
87
xrm::S
98
end
109

@@ -17,7 +16,7 @@ The presolve operations currently implemented are:
1716
- [`remove_ifix!`](@ref)
1817
1918
"""
20-
function presolve(qm::QuadraticModel{T, S}; kwargs...) where {T <: Real, S}
19+
function presolve(qm::QuadraticModel{T, S, M1, M2}; kwargs...) where {T <: Real, S, M1 <: SparseMatrixCOO, M2 <: SparseMatrixCOO}
2120
psqm = deepcopy(qm)
2221
psdata = psqm.data
2322
lvar, uvar = psqm.meta.lvar, psqm.meta.uvar
@@ -28,13 +27,13 @@ function presolve(qm::QuadraticModel{T, S}; kwargs...) where {T <: Real, S}
2827
if length(ifix) > 0
2928
xrm, psdata.c0, nvarps = remove_ifix!(
3029
ifix,
31-
psdata.Hrows,
32-
psdata.Hcols,
33-
psdata.Hvals,
30+
psdata.H.rows,
31+
psdata.H.cols,
32+
psdata.H.vals,
3433
nvar,
35-
psdata.Arows,
36-
psdata.Acols,
37-
psdata.Avals,
34+
psdata.A.rows,
35+
psdata.A.cols,
36+
psdata.A.vals,
3837
psdata.c,
3938
psdata.c0,
4039
lvar,
@@ -48,12 +47,12 @@ function presolve(qm::QuadraticModel{T, S}; kwargs...) where {T <: Real, S}
4847
end
4948

5049
# form meta
51-
nnzh = length(psdata.Hvals)
52-
if !(nnzh == length(psdata.Hrows) == length(psdata.Hcols))
50+
nnzh = length(psdata.H.vals)
51+
if !(nnzh == length(psdata.H.rows) == length(psdata.H.cols))
5352
error("The length of Hrows, Hcols and Hvals must be the same")
5453
end
55-
nnzj = length(psdata.Avals)
56-
if !(nnzj == length(psdata.Arows) == length(psdata.Acols))
54+
nnzj = length(psdata.A.vals)
55+
if !(nnzj == length(psdata.A.rows) == length(psdata.A.cols))
5756
error("The length of Arows, Acols and Avals must be the same")
5857
end
5958
psmeta = NLPModelMeta{T, S}(

0 commit comments

Comments
 (0)