Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrea committed Jun 18, 2022
1 parent d678122 commit 0cef744
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/constraints.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
struct BoxConstraints
lb::Vector{Float64}
ub::Vector{Float64}
al::Vector{Float64}
au::Vector{Float64}
struct BoxConstraints{V1, V2}
lb::V1
ub::V2
al::V1
au::V2
end
function BoxConstraints(lb, ub)
function BoxConstraints(lb::V1, ub::V2) where {V1, V2}
BoxConstraints(lb, ub,
[!isfinite(lb[i]) ? 1 : min((ub[i] - lb[i])/2, (1 + abs(lb[i]))/20)
for i in eachindex(lb)],
[!isfinite(ub[i]) ? 1 : min((ub[i] - lb[i])/2, (1 + abs(ub[i]))/20)
for i in eachindex(ub)]
convert(V1, [!isfinite(lb[i]) ? 1 : min((ub[i] - lb[i])/2, (1 + abs(lb[i]))/20)
for i in eachindex(lb)]),
convert(V2, [!isfinite(ub[i]) ? 1 : min((ub[i] - lb[i])/2, (1 + abs(ub[i]))/20)
for i in eachindex(ub)])
)
end
_constraints(::Nothing, ::Nothing) = nothing
Expand Down
9 changes: 4 additions & 5 deletions src/log.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
log!(::Any, ::Any, ::Any, ::Any) = nothing
mutable struct BasicLogger{F}
mutable struct BasicLogger{F, V}
fbest::Vector{Float64}
xbest::Vector{Vector{Float64}}
xbest::Vector{V}
fmedian::Vector{Float64}
frange::Vector{Float64}
times::Vector{Float64}
Expand All @@ -11,9 +11,8 @@ end
function Base.show(io::IO, ::MIME"text/plain", s::BasicLogger)
println(io, "BasicLogger")
end
function BasicLogger(x0; verbosity = 1,
callback = (o, y, fvals, perm) -> nothing)
BasicLogger(Float64[], Vector{Float64}[], Float64[], Float64[], Float64[],
function BasicLogger(::V; verbosity = 1, callback = (o, y, fvals, perm) -> nothing) where V
BasicLogger(Float64[], V[], Float64[], Float64[], Float64[],
callback, verbosity)
end
function log!(o::Optimizer{<:Any, <:BasicLogger}, y, fvals, perm)
Expand Down

3 comments on commit 0cef744

@jbrea
Copy link
Owner Author

@jbrea jbrea commented on 0cef744 Jun 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbrea
Copy link
Owner Author

@jbrea jbrea commented on 0cef744 Jun 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/62704

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.3 -m "<description of version>" 0cef744cfdd3cb5458ed79e4f4462d3df08540b1
git push origin v0.2.3

Please sign in to comment.