File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed
Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change 11export toint
22
33function toint (; n:: Int = default_nvar, type:: Type{T} = Float64, kwargs... ) where {T}
4- function f (x; n = length (x))
5- s = zero (T)
6- for i = 1 : n
7- ci = 1 + (i // 10 )
4+ function f (x; n = length (x))
5+ s = zero (T)
6+ for i ∈ 1 : n
7+ ci = 1 + (i // 10 )
88
9- for j = max (1 , i - 2 ): min (n, i + 2 )
10- aij = 5 * (1 + mod (i, 5 ) + mod (j, 5 ))
11- bij = (i + j) // 10
12- cj = 1 + (j // 10 )
13- s += aij * sin (bij + ci * x[i] + cj * x[j])
14- end
15- end
16- return s / n
17- end
9+ for j ∈ max (1 , i- 2 ): min (n, i+ 2 )
10+ aij = 5 * (1 + mod (i, 5 ) + mod (j, 5 ))
11+ bij = (i + j) // 10
12+ cj = ( 1 + j) // 10
13+ s += aij * sin (bij + ci * x[i] + cj * x[j])
14+ end
15+ end
16+ return s / n
17+ end
1818
19- x0 = fill (one (T), n)
20- return ADNLPModels. ADNLPModel (f, x0, name = " toint" ; kwargs... )
19+ x0 = fill (one (T), n)
20+ return ADNLPModels. ADNLPModel (f, x0, name = " toint" ; kwargs... )
2121end
You can’t perform that action at this time.
0 commit comments