Skip to content

Commit db7c813

Browse files
🤖 Format .jl files (#343)
Co-authored-by: tmigot <[email protected]>
1 parent 36d8941 commit db7c813

40 files changed

+262
-136
lines changed

src/ADNLPProblems/allinit.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function allinit(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) wh
2121
# return cx
2222
#end
2323
A = T[
24-
0 0 0 1;
25-
0 1 0 0;
24+
0 0 0 1
25+
0 1 0 0
2626
0 0 1 0
2727
]
2828

src/ADNLPProblems/allinitc.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function allinitc(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) w
1919
return cx
2020
end
2121
A = T[
22-
0 0 0 1;
23-
0 1 0 0;
22+
0 0 0 1
23+
0 1 0 0
2424
0 0 1 0
2525
]
2626

src/ADNLPProblems/alsotame.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function alsotame(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) w
1515
return cx
1616
end
1717
A = T[
18-
1 0 0;
18+
1 0 0
1919
0 1 0
2020
]
2121

src/ADNLPProblems/avion2.jl

Lines changed: 151 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,145 @@ function avion2(::Val{:nlp}; n::Int = default_nvar, type::Type{T} = Float64, kwa
179179
1,
180180
1,
181181
]
182-
A = sparse([1, 2, 3, 2, 4, 3, 1, 4, 4, 4, 4, 5, 5, 7, 10, 14, 6, 8, 14, 14, 6, 13, 15, 7, 7, 8, 15, 9, 15, 10, 15, 11, 15, 12, 15, 13, 15, 9, 14, 11, 14, 12, 14], [1, 1, 2, 5, 5, 6, 7, 7, 8, 9, 10, 10,
183-
19, 20, 20, 20, 22, 22, 22, 23, 24, 26, 31, 33, 34, 35, 35, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 47, 47, 48, 48, 49, 49], T[-0.13, -0.7, -1.0, 1.0, -2.0, 1.0, 1.0, -2.0, -2.0, -1.0, 1.0, -20.0, 1.0, -1.0, -0.043, 0.5, -2.0, -0.137, -1.0, 1.0, 1.0, -300.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -35.0, 660.0, -200.0, 95.0, -120.0, 70.0], 15, 49)
182+
A = sparse(
183+
[
184+
1,
185+
2,
186+
3,
187+
2,
188+
4,
189+
3,
190+
1,
191+
4,
192+
4,
193+
4,
194+
4,
195+
5,
196+
5,
197+
7,
198+
10,
199+
14,
200+
6,
201+
8,
202+
14,
203+
14,
204+
6,
205+
13,
206+
15,
207+
7,
208+
7,
209+
8,
210+
15,
211+
9,
212+
15,
213+
10,
214+
15,
215+
11,
216+
15,
217+
12,
218+
15,
219+
13,
220+
15,
221+
9,
222+
14,
223+
11,
224+
14,
225+
12,
226+
14,
227+
],
228+
[
229+
1,
230+
1,
231+
2,
232+
5,
233+
5,
234+
6,
235+
7,
236+
7,
237+
8,
238+
9,
239+
10,
240+
10,
241+
19,
242+
20,
243+
20,
244+
20,
245+
22,
246+
22,
247+
22,
248+
23,
249+
24,
250+
26,
251+
31,
252+
33,
253+
34,
254+
35,
255+
35,
256+
37,
257+
37,
258+
38,
259+
38,
260+
39,
261+
39,
262+
40,
263+
40,
264+
41,
265+
41,
266+
47,
267+
47,
268+
48,
269+
48,
270+
49,
271+
49,
272+
],
273+
T[
274+
-0.13,
275+
-0.7,
276+
-1.0,
277+
1.0,
278+
-2.0,
279+
1.0,
280+
1.0,
281+
-2.0,
282+
-2.0,
283+
-1.0,
284+
1.0,
285+
-20.0,
286+
1.0,
287+
-1.0,
288+
-0.043,
289+
0.5,
290+
-2.0,
291+
-0.137,
292+
-1.0,
293+
1.0,
294+
1.0,
295+
-300.0,
296+
1.0,
297+
-1.0,
298+
1.0,
299+
1.0,
300+
-1.0,
301+
1.0,
302+
1.0,
303+
1.0,
304+
1.0,
305+
1.0,
306+
1.0,
307+
1.0,
308+
1.0,
309+
1.0,
310+
1.0,
311+
-35.0,
312+
660.0,
313+
-200.0,
314+
95.0,
315+
-120.0,
316+
70.0,
317+
],
318+
15,
319+
49,
320+
)
184321
function c!(cx, x)
185322
return cx
186323
end
@@ -289,7 +426,18 @@ function avion2(::Val{:nlp}; n::Int = default_nvar, type::Type{T} = Float64, kwa
289426
2,
290427
]
291428

292-
return ADNLPModels.ADNLPModel!(f, x0, lvar, uvar, findnz(A)..., c!, lcon, ucon, name = "avion2"; kwargs...)
429+
return ADNLPModels.ADNLPModel!(
430+
f,
431+
x0,
432+
lvar,
433+
uvar,
434+
findnz(A)...,
435+
c!,
436+
lcon,
437+
ucon,
438+
name = "avion2";
439+
kwargs...,
440+
)
293441
end
294442

295443
function avion2(::Val{:nls}; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}

src/ADNLPProblems/booth.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function booth(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) wher
77
x0 = zeros(T, 2)
88

99
A = T[
10-
1 2;
10+
1 2
1111
2 1
1212
]
1313
function c!(cx, x)

src/ADNLPProblems/camshape.jl

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,36 @@ function camshape(args...; n::Int = default_nvar, type::Type{T} = Float64, kwarg
2424
ucon = vcat(T(0), T* θ) * ones(T, n + 1), zeros(T, n + 1))
2525

2626
A = zeros(T, n + 2, n)
27-
A[2,n] = -1
27+
A[2, n] = -1
2828
lcon[2] -= R_max
2929
ucon[2] -= R_max
30-
A[3,1] = 1
30+
A[3, 1] = 1
3131
lcon[3] += R_min
3232
ucon[3] += R_min
3333
for i = 1:(n - 1)
3434
A[3 + i, i + 1] = 1
3535
A[3 + i, i] = -1
3636
end
3737
# cx[n + 3] = -R_min^2 - R_min * y[1] + 2 * R_min * y[1] * cos(θ)
38-
A[1, 1] = -R_min + 2 * R_min * cos(θ)
38+
A[1, 1] = -R_min + 2 * R_min * cos(θ)
3939
lcon[1] += R_min^2
4040
ucon[1] += R_min^2
4141

4242
lvar = T(R_min) * ones(T, n)
4343
uvar = T(R_max) * ones(T, n)
44-
44+
4545
x0 = T((R_min + R_max) / 2) * ones(T, n)
46-
return ADNLPModels.ADNLPModel!(f, x0, lvar, uvar, findnz(sparse(A))..., c!, lcon, ucon, name = "camshape", ; kwargs...)
46+
return ADNLPModels.ADNLPModel!(
47+
f,
48+
x0,
49+
lvar,
50+
uvar,
51+
findnz(sparse(A))...,
52+
c!,
53+
lcon,
54+
ucon,
55+
name = "camshape",
56+
;
57+
kwargs...,
58+
)
4759
end

src/ADNLPProblems/catenary.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
export catenary
22

3-
function catenary(args...; n::Int = default_nvar, type::Type{T} = Float64, Bl = 1, FRACT = 0.6, kwargs...) where {T}
3+
function catenary(
4+
args...;
5+
n::Int = default_nvar,
6+
type::Type{T} = Float64,
7+
Bl = 1,
8+
FRACT = 0.6,
9+
kwargs...,
10+
) where {T}
411
(n % 3 == 0) || @warn("catenary: number of variables adjusted to be a multiple of 3")
512
n = 3 * max(1, div(n, 3))
613
(n < 6) || @warn("catenary: number of variables adjusted to be greater or equal to 6")

src/ADNLPProblems/hs100.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ function hs100(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) wher
1212
end
1313
x0 = T[1, 2, 0, 4, 0, 1, 1]
1414
function c!(cx, x)
15-
cx[1] = - 7 * x[1] - 3 * x[2] - 10 * x[3]^2 - x[4] + x[5]
16-
cx[2] = - 23 * x[1] - x[2]^2 - 6 * x[6]^2 + 8 * x[7]
15+
cx[1] = -7 * x[1] - 3 * x[2] - 10 * x[3]^2 - x[4] + x[5]
16+
cx[2] = -23 * x[1] - x[2]^2 - 6 * x[6]^2 + 8 * x[7]
1717
cx[4] = 127 - 2 * x[1]^2 - 3 * x[2]^4 - x[3] - 4 * x[4]^2 - 5 * x[5]
1818
cx[3] = -4 * x[1]^2 - x[2]^2 + 3 * x[1] * x[2] - 2 * x[3]^2 - 5 * x[6] + 11 * x[7]
1919
return cx

src/ADNLPProblems/hs108.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ function hs108(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) wher
1010
lvar = T[-Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, 0]
1111
uvar = T(Inf) * ones(T, 9)
1212
function c!(cx, x)
13-
cx[1] = - x[3]^2 - x[4]^2
14-
cx[2] = - x[5]^2 - x[6]^2
15-
cx[3] = - (x[1] - x[5])^2 - (x[2] - x[6])^2
16-
cx[4] = - (x[1] - x[7])^2 - (x[2] - x[8])^2
17-
cx[5] = - (x[3] - x[5])^2 - (x[4] - x[6])^2
18-
cx[6] = - (x[3] - x[7])^2 - (x[4] - x[8])^2
13+
cx[1] = -x[3]^2 - x[4]^2
14+
cx[2] = -x[5]^2 - x[6]^2
15+
cx[3] = -(x[1] - x[5])^2 - (x[2] - x[6])^2
16+
cx[4] = -(x[1] - x[7])^2 - (x[2] - x[8])^2
17+
cx[5] = -(x[3] - x[5])^2 - (x[4] - x[6])^2
18+
cx[6] = -(x[3] - x[7])^2 - (x[4] - x[8])^2
1919
cx[7] = x[3] * x[9]
2020
cx[8] = x[5] * x[8] - x[6] * x[7]
21-
cx[9] = - x[9]^2
22-
cx[10] = - x[1]^2 - (x[2] - x[9])^2
21+
cx[9] = -x[9]^2
22+
cx[10] = -x[1]^2 - (x[2] - x[9])^2
2323
cx[11] = x[1] * x[4] - x[2] * x[3]
2424
cx[12] = -x[5] * x[9]
2525
return cx

src/ADNLPProblems/hs109.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ function hs109(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) wher
1212
a = 50176 // 1000
1313
b = sin(eltype(x)(25 // 100))
1414
ci = cos(eltype(x)(25 // 100))
15-
cx[1] = - x[1]^2 - x[8]^2
16-
cx[2] = - x[2]^2 - x[9]^2
15+
cx[1] = -x[1]^2 - x[8]^2
16+
cx[2] = -x[2]^2 - x[9]^2
1717
cx[3] =
1818
x[5] * x[6] * sin(-x[3] - 1 / 4) + x[5] * x[7] * sin(-x[4] - 1 / 4) + 2 * b * x[5]^2 -
1919
a * x[1] + 400 * a
@@ -36,7 +36,7 @@ function hs109(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) wher
3636
2 * ci * x[7]^2 + 0.7533e-3 * a * x[7]^2
3737
return cx
3838
end
39-
lcon = vcat(-T(0.55), - 2250000, -2250000, zeros(T, 6))
39+
lcon = vcat(-T(0.55), -2250000, -2250000, zeros(T, 6))
4040
ucon = vcat(T(0.55), T(Inf), T(Inf), zeros(T, 6))
4141
return ADNLPModels.ADNLPModel!(
4242
f,

0 commit comments

Comments
 (0)