From 8028979df74b0acc12ba52b9dc0163be4eea85de Mon Sep 17 00:00:00 2001 From: amontoison Date: Fri, 26 Dec 2025 18:48:57 +0000 Subject: [PATCH] :robot: Format .jl files --- src/ADNLPProblems/hs117.jl | 34 +++-- src/ADNLPProblems/hs119.jl | 282 +++++++++++++++++++++++++++++++++++- src/ADNLPProblems/lincon.jl | 3 +- src/PureJuMP/hs117.jl | 12 +- 4 files changed, 303 insertions(+), 28 deletions(-) diff --git a/src/ADNLPProblems/hs117.jl b/src/ADNLPProblems/hs117.jl index 5da9ccf0..88ba88d8 100644 --- a/src/ADNLPProblems/hs117.jl +++ b/src/ADNLPProblems/hs117.jl @@ -1,24 +1,28 @@ export hs117 function hs117(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T} - a = Rational{Int}[-16 2 0 1 0; - 0 -2 0 4 2; - -7 // 2 0 2 0 0; - 0 -2 0 -4 -1; - 0 -9 -2 1 -14 // 5; - 2 0 -4 0 0; - -1 -1 -1 -1 -1; - -1 -2 -3 -2 -1; - 1 2 3 4 5; - 1 1 1 1 1] + a = Rational{Int}[ + -16 2 0 1 0; + 0 -2 0 4 2; + -7 // 2 0 2 0 0; + 0 -2 0 -4 -1; + 0 -9 -2 1 -14 // 5; + 2 0 -4 0 0; + -1 -1 -1 -1 -1; + -1 -2 -3 -2 -1; + 1 2 3 4 5; + 1 1 1 1 1 + ] b = [-40, -2, -25 // 100, -4, -4, -1, -40, -60, 5, 1] - c = [ 30 -20 -10 32 -10; - -20 39 -6 -31 32; - -10 -6 10 -6 -10; - 32 -31 -6 39 -20; - -10 32 -10 -20 30] + c = [ + 30 -20 -10 32 -10; + -20 39 -6 -31 32; + -10 -6 10 -6 -10; + 32 -31 -6 39 -20; + -10 32 -10 -20 30 + ] d = [4, 8, 10, 6, 2] diff --git a/src/ADNLPProblems/hs119.jl b/src/ADNLPProblems/hs119.jl index c6b74393..73052132 100644 --- a/src/ADNLPProblems/hs119.jl +++ b/src/ADNLPProblems/hs119.jl @@ -1,15 +1,271 @@ export hs119 function hs119(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T} - Q_rows = [1, 2, 2, 3, 1, 4, 5, 5, 6, 1, 2, 3, 4, 7, 1, 6, 8, 3, 9, 2, 3, 5, 8, 10, 4, 7, 11, 5, 9, 12, 7, 11, 13, 3, 10, 12, 13, 14, 4, 6, 8, 15, 1, 5, 9, 16] - Q_cols = [1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16] + Q_rows = [ + 1, + 2, + 2, + 3, + 1, + 4, + 5, + 5, + 6, + 1, + 2, + 3, + 4, + 7, + 1, + 6, + 8, + 3, + 9, + 2, + 3, + 5, + 8, + 10, + 4, + 7, + 11, + 5, + 9, + 12, + 7, + 11, + 13, + 3, + 10, + 12, + 13, + 14, + 4, + 6, + 8, + 15, + 1, + 5, + 9, + 16, + ] + Q_cols = [ + 1, + 2, + 3, + 3, + 4, + 4, + 5, + 6, + 6, + 7, + 7, + 7, + 7, + 7, + 8, + 8, + 8, + 9, + 9, + 10, + 10, + 10, + 10, + 10, + 11, + 11, + 11, + 12, + 12, + 12, + 13, + 13, + 13, + 14, + 14, + 14, + 14, + 14, + 15, + 15, + 15, + 15, + 16, + 16, + 16, + 16, + ] - clinrows = [1, 2, 3, 4, 7, 1, 3, 4, 6, 8, 1, 2, 4, 6, 8, 1, 2, 4, 5, 7, 8, 1, 2, 3, 5, 6, 8, 1, 3, 4, 5, 6, 1, 2, 4, 5, 6, 7, 8, 1, 3, 5, 6, 8, 1, 7, 2, 3, 4, 5, 6, 7, 8] - clincols = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16] - clinvals = T[0.22, -1.46, 1.29, -1.1, 1.12, 0.2, -0.89, -1.06, -1.72, 0.45, 0.19, -1.3, 0.95, -0.33, 0.26, 0.25, 1.82, -0.54, -1.43, 0.31, -1.1, 0.15, -1.15, -1.16, 1.51, 1.62, 0.58, 0.11, -0.96, -1.78, 0.59, 1.24, 0.12, 0.8, -0.41, -0.33, 0.21, 1.12, -1.03, 0.13, -0.49, -0.43, -0.26, 0.1, 1.0, -0.36, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] + clinrows = [ + 1, + 2, + 3, + 4, + 7, + 1, + 3, + 4, + 6, + 8, + 1, + 2, + 4, + 6, + 8, + 1, + 2, + 4, + 5, + 7, + 8, + 1, + 2, + 3, + 5, + 6, + 8, + 1, + 3, + 4, + 5, + 6, + 1, + 2, + 4, + 5, + 6, + 7, + 8, + 1, + 3, + 5, + 6, + 8, + 1, + 7, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + ] + clincols = [ + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 4, + 4, + 4, + 4, + 4, + 4, + 5, + 5, + 5, + 5, + 5, + 5, + 6, + 6, + 6, + 6, + 6, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 8, + 8, + 8, + 8, + 8, + 9, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + ] + clinvals = T[ + 0.22, + -1.46, + 1.29, + -1.1, + 1.12, + 0.2, + -0.89, + -1.06, + -1.72, + 0.45, + 0.19, + -1.3, + 0.95, + -0.33, + 0.26, + 0.25, + 1.82, + -0.54, + -1.43, + 0.31, + -1.1, + 0.15, + -1.15, + -1.16, + 1.51, + 1.62, + 0.58, + 0.11, + -0.96, + -1.78, + 0.59, + 1.24, + 0.12, + 0.8, + -0.41, + -0.33, + 0.21, + 1.12, + -1.03, + 0.13, + -0.49, + -0.43, + -0.26, + 0.1, + 1.0, + -0.36, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + ] function f(x; rows = Q_rows, cols = Q_cols) - return sum((x[rows[k]]^2 + x[rows[k]] + 1) * (x[cols[k]]^2 + x[cols[k]] + 1) for k in 1:46) + return sum((x[rows[k]]^2 + x[rows[k]] + 1) * (x[cols[k]]^2 + x[cols[k]] + 1) for k = 1:46) end x0 = 10 * ones(T, 16) @@ -35,5 +291,17 @@ function hs119(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) wher 36.8, -24, ] - return ADNLPModels.ADNLPModel(f, x0, lvar, uvar, clinrows, clincols, clinvals, lcon, ucon, name = "hs119"; kwargs...) + return ADNLPModels.ADNLPModel( + f, + x0, + lvar, + uvar, + clinrows, + clincols, + clinvals, + lcon, + ucon, + name = "hs119"; + kwargs..., + ) end diff --git a/src/ADNLPProblems/lincon.jl b/src/ADNLPProblems/lincon.jl index 178371b4..e4d18007 100644 --- a/src/ADNLPProblems/lincon.jl +++ b/src/ADNLPProblems/lincon.jl @@ -6,7 +6,8 @@ function lincon(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) whe clinrows = [5, 6, 5, 6, 8, 9, 10, 3, 2, 11, 11, 4, 4, 4, 7, 7, 1] clincols = [1, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] - clinvals = T[1.0, 3.0, 2.0, 4.0, 9.0, 12.0, 15.0, 4.0, -2.0, 5.0, 6.0, 1.0, 2.0, 3.0, 1.0, -1.0, 15.0] + clinvals = + T[1.0, 3.0, 2.0, 4.0, 9.0, 12.0, 15.0, 4.0, -2.0, 5.0, 6.0, 1.0, 2.0, 3.0, 1.0, -1.0, 15.0] lcon = T[22.0, -1.0, 1.0, 1.0, -5.0, -6.0, -Inf, -Inf, -Inf, -Inf, -11.0] ucon = T[22.0, -1.0, 1.0, Inf, Inf, Inf, 16.0, 1.0, 2.0, 3.0, 9.0] diff --git a/src/PureJuMP/hs117.jl b/src/PureJuMP/hs117.jl index 722a4398..7bbf6599 100644 --- a/src/PureJuMP/hs117.jl +++ b/src/PureJuMP/hs117.jl @@ -33,11 +33,13 @@ function hs117(args...; kwargs...) b = [-40, -2, -0.25, -4, -4, -1, -40, -60, 5, 1] - c = Float64[ 30 -20 -10 32 -10; - -20 39 -6 -31 32; - -10 -6 10 -6 -10; - 32 -31 -6 39 -20; - -10 32 -10 -20 30] + c = Float64[ + 30 -20 -10 32 -10; + -20 39 -6 -31 32; + -10 -6 10 -6 -10; + 32 -31 -6 39 -20; + -10 32 -10 -20 30 + ] d = [4, 8, 10, 6, 2]