Skip to content

Commit 2dedd7d

Browse files
geoffroylecontedpo
andcommitted
Apply suggestions from code review
Co-authored-by: Dominique <dominique.orban@gmail.com>
1 parent 793e915 commit 2dedd7d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/qp_rand_model.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ using .QuadraticModels
66
77
Return an instance of a `QuadraticModel` representing
88
9-
½ xᵀHx + cᵀx s.t. l ≤ x ≤ u,
9+
min cᵀx + ½ xᵀHx s.t. l ≤ x ≤ u,
1010
11-
with H = A + A' or H = A * A' + I (see the `convex` keyword argument) where A is a random square matrix with density `dens`, `l = -e -tₗ` and `u = e + tᵤ` where `tₗ` and `tᵤ` are sampled from a uniform distribution between 0 and 1.
11+
with H = A + A' or H = A * A' (see the `convex` keyword argument) where A is a random square matrix with density `dens`, `l = -e - tₗ` and `u = e + tᵤ` where `e` is the vector of ones, and `tₗ` and `tᵤ` are sampled from a uniform distribution between 0 and 1.
1212
1313
## Arguments
1414
@@ -17,15 +17,15 @@ with H = A + A' or H = A * A' + I (see the `convex` keyword argument) where A is
1717
## Keyword arguments
1818
1919
* `dens :: Real`: density of `A`` used to generate the quadratic model (default: `1.0e-4`).
20-
* `convex :: Bool`: true to generate a convex `H` (default: `false`).
20+
* `convex :: Bool`: true to generate positive definite `H` (default: `false`).
2121
2222
## Return Value
2323
2424
An instance of a `QuadraticModel`.
2525
"""
2626
function qp_rand_model(n::Int; dens::R = 1.0e-4, convex::Bool = false) where {R <: Real}
2727
A = sprandn(R, n, n, dens)
28-
H = convex ? (A * A') : (A + A') #+ I
28+
H = convex ? (A * A') : (A + A')
2929
c = randn(R, n)
3030
l = -one(R) .- rand(R, n)
3131
u = one(R) .+ rand(R, n)

0 commit comments

Comments
 (0)