From 83bf3aa69d4d5b8c99d9c7cd6c51269b171d4174 Mon Sep 17 00:00:00 2001 From: geoffroyleconte <47035783+geoffroyleconte@users.noreply.github.com> Date: Sat, 16 Mar 2024 14:22:23 -0400 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Dominique --- src/qp_rand_model.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qp_rand_model.jl b/src/qp_rand_model.jl index 795e4b8..962d345 100644 --- a/src/qp_rand_model.jl +++ b/src/qp_rand_model.jl @@ -6,9 +6,9 @@ using .QuadraticModels Return an instance of a `QuadraticModel` representing - ½ xᵀHx + cᵀx s.t. l ≤ x ≤ u, + min cᵀx + ½ xᵀHx s.t. l ≤ x ≤ u, -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. +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. ## Arguments @@ -17,7 +17,7 @@ with H = A + A' or H = A * A' + I (see the `convex` keyword argument) where A is ## Keyword arguments * `dens :: Real`: density of `A`` used to generate the quadratic model (default: `1.0e-4`). -* `convex :: Bool`: true to generate a convex `H` (default: `false`). +* `convex :: Bool`: true to generate positive definite `H` (default: `false`). ## Return Value @@ -25,7 +25,7 @@ An instance of a `QuadraticModel`. """ function qp_rand_model(n::Int; dens::R = 1.0e-4, convex::Bool = false) where {R <: Real} A = sprandn(R, n, n, dens) - H = convex ? (A * A') : (A + A') #+ I + H = convex ? (A * A') : (A + A') c = randn(R, n) l = -one(R) .- rand(R, n) u = one(R) .+ rand(R, n)