Skip to content

Commit 2706339

Browse files
committed
Fix islp
1 parent 36ba453 commit 2706339

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/lpmodel.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function LinearModel(
9999
nnzh = 0
100100
nnzj = nnz(A)
101101
H = similar_empty_matrix(A, length(c))
102-
data = QPData(c0, c, H, A)
102+
data = QPData(c0, c, H, A; lp=true)
103103

104104
LinearModel(
105105
NLPModelMeta{T, S}(
@@ -163,7 +163,7 @@ function NLPModels.objgrad!(qp::LinearModel, x::AbstractVector, g::AbstractVecto
163163
NLPModels.increment!(qp, :neval_obj)
164164
NLPModels.increment!(qp, :neval_grad)
165165
f = qp.data.c0 + dot(qp.data.c, x)
166-
g .+= qp.data.c
166+
g .= qp.data.c
167167
return f, g
168168
end
169169

src/qpmodel.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mutable struct QPData{
1313
A::M2
1414
end
1515

16-
QPData(c0, c, H, A) = QPData(c0, c, similar(c), H, A)
16+
QPData(c0, c, H, A; lp::Bool=false) = QPData(c0, c, lp ? similar(c): similar(c, 0), H, A)
1717
isdense(data::QPData{T, S, M1, M2}) where {T, S, M1, M2} = M1 <: DenseMatrix || M2 <: DenseMatrix
1818

1919
function Base.convert(
@@ -29,7 +29,7 @@ Base.convert(
2929
data::QPData{T, S, M1, M2},
3030
) where {T, S, M1 <: SparseMatrixCOO, M2 <: SparseMatrixCOO, MCOO <: SparseMatrixCOO{T}} = data
3131

32-
abstract type AbstractQuadraticModel{T, S} <: AbstractNLPModel{T, S} end
32+
abstract type AbstractQuadraticModel{T, S, M1, M2} <: AbstractNLPModel{T, S} end
3333

3434
"""
3535
qp = QuadraticModel(c, Hrows, Hcols, Hvals; Arows = Arows, Acols = Acols, Avals = Avals,
@@ -137,7 +137,7 @@ function QuadraticModel(
137137
nln_nnzj = 0,
138138
nnzh = nnzh,
139139
lin = 1:ncon,
140-
islp = (nnzh == 0);
140+
islp = false;
141141
kwargs...,
142142
),
143143
Counters(),
@@ -192,7 +192,7 @@ function QuadraticModel(
192192
nln_nnzj = 0,
193193
nnzh = nnzh,
194194
lin = 1:ncon,
195-
islp = (nnzh == 0);
195+
islp = false;
196196
kwargs...,
197197
),
198198
Counters(),

0 commit comments

Comments
 (0)