Skip to content

Commit 9c58ae9

Browse files
committed
🤖 Format .jl files
1 parent 104db00 commit 9c58ae9

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/presolve/presolve.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ The presolve operations currently implemented are:
1717
1818
"""
1919
function presolve(qm::QuadraticModel{T, S}; kwargs...) where {T <: Real, S}
20-
2120
psqm = deepcopy(qm)
2221
psdata = psqm.data
2322
lvar, uvar = psqm.meta.lvar, psqm.meta.uvar
@@ -83,10 +82,15 @@ end
8382
Retrieve the solution `x_out` of the original QP `qm` given the solution of the presolved QP (`psqm`)
8483
`x_in`.
8584
"""
86-
function postsolve!(qm::QuadraticModel{T, S}, psqm::PresolvedQuadraticModel{T, S}, x_in::S, x_out::S) where {T, S}
85+
function postsolve!(
86+
qm::QuadraticModel{T, S},
87+
psqm::PresolvedQuadraticModel{T, S},
88+
x_in::S,
89+
x_out::S,
90+
) where {T, S}
8791
if length(qm.meta.ifix) > 0
8892
restore_ifix!(qm.meta.ifix, psqm.xrm, x_in, x_out)
8993
else
90-
x_out .= @views x_in[1: qm.meta.nvar]
94+
x_out .= @views x_in[1:(qm.meta.nvar)]
9195
end
9296
end

src/presolve/remove_ifix.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function remove_ifix!(
3131
lcon,
3232
ucon,
3333
) where {T}
34-
34+
3535
# assume Hcols is sorted
3636
c0_offset = zero(T)
3737
Hnnz = length(Hrows)
@@ -51,15 +51,15 @@ function remove_ifix!(
5151

5252
Hwritepos = 1
5353
# shift corresponding to the already removed fixed variables to update c:
54-
shiftHj = 1
54+
shiftHj = 1
5555
if Hnnz > 0
5656
oldHj = Hrows[1]
5757
end
5858
# remove ifix in H and update data
5959
k = 1
6060
while k <= Hnnz && Hcols[k] <= (nvar - idxfix + 1)
6161
Hi, Hj, Hx = Hrows[k], Hcols[k], Hvals[k] # Hj sorted
62-
62+
6363
while (Hj == oldHj) && shiftHj <= idxfix - 1 && Hj + shiftHj - 1 >= ifix[shiftHj]
6464
shiftHj += 1
6565
end

test/test_presolve.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
c0 = 0.0,
2525
name = "QM1",
2626
)
27-
27+
2828
psqp = presolve(qp)
2929

3030
c_true = [-4.0; 1.0]
@@ -37,7 +37,7 @@
3737
1.0 1.0
3838
0.0 1.0
3939
]
40-
lvarps_true, uvarps_true = [0. ; 0.], [Inf; Inf]
40+
lvarps_true, uvarps_true = [0.0; 0.0], [Inf; Inf]
4141

4242
@test psqp.data.c == [-4.0; 1.0]
4343
@test psqp.data.c0 == 4.0
@@ -55,4 +55,4 @@
5555
x_out = zeros(3)
5656
postsolve!(qp, psqp, x_in, x_out)
5757
@test x_out == [4.0; 2.0; 7.0]
58-
end
58+
end

0 commit comments

Comments
 (0)