Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamed82008 committed Nov 16, 2023
1 parent f76af4d commit 30d212a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NonconvexMultistart"
uuid = "11b12826-7e46-4acf-9706-be0a67f2add7"
authors = ["Mohamed Tarek <mohamed82008@gmail.com> and contributors"]
version = "0.1.3"
version = "0.1.4"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand All @@ -14,12 +14,12 @@ Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
Sobol = "ed01d8cd-4d21-5b2a-85b4-cc3bdc58bad4"

[compat]
ChainRulesCore = "0.10, 1"
ChainRulesCore = "1"
Hyperopt = "0.4"
NonconvexCore = "1"
Parameters = "0.12"
Parameters = "0.12, 0.13"
Reexport = "1"
Setfield = "0.7, 0.8, 1"
Setfield = "1"
Sobol = "1"
julia = "1"

Expand Down
2 changes: 1 addition & 1 deletion src/NonconvexMultistart.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Hyperopt
using Reexport, Parameters, Setfield, ChainRulesCore, Sobol
@reexport using NonconvexCore
using NonconvexCore:
reset!, isfeasible, @params, VecModel, AbstractOptimizer, AbstractResult
reset!, isfeasible, VecModel, AbstractOptimizer, AbstractResult
import NonconvexCore: optimize!, Workspace

include("hyperopt.jl")
Expand Down
38 changes: 19 additions & 19 deletions src/hyperopt.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@params struct HyperoptAlg <: AbstractOptimizer
sub_alg::AbstractOptimizer
struct HyperoptAlg{S <: AbstractOptimizer} <: AbstractOptimizer
sub_alg::S
end

"""
Expand All @@ -15,14 +15,14 @@ end
- `ctol`: infeasibility tolerance for accepting a solution as feasible
- `keep_all`: if true, all the solutions of the sub-problems will be saved
"""
@params struct HyperoptOptions
sub_options::Any
lb::Any
ub::Any
searchspace_size::Integer
iters::Integer
sampler::Hyperopt.Sampler
ctol::Any
struct HyperoptOptions{S1, L, U, S2 <: Hyperopt.Sampler, C}
sub_options::S1
lb::L
ub::U
searchspace_size::Int
iters::Int
sampler::S2
ctol::C
keep_all::Bool
end
function HyperoptOptions(;
Expand All @@ -47,10 +47,10 @@ function HyperoptOptions(;
)
end

@params struct HyperoptWorkspace <: Workspace
sub_workspace::Workspace
x0::AbstractVector
options::HyperoptOptions
struct HyperoptWorkspace{S <: Workspace, X <: AbstractVector, O <: HyperoptOptions} <: Workspace
sub_workspace::S
x0::X
options::O
end

function Workspace(
Expand Down Expand Up @@ -78,11 +78,11 @@ When using multiple x0 in [`optimize`](@ref), return this result, including foll
- `results`: all the search results.
- `optimal_ind`: the index of the optimal solution in `results`.
"""
@params struct HyperoptResult <: AbstractResult
minimum::Any
minimizer::Any
results::Any
optimal_ind::Any
struct HyperoptResult{M1, M2, R, O} <: AbstractResult
minimum::M1
minimizer::M2
results::R
optimal_ind::O
end

function optimize!(workspace::HyperoptWorkspace)
Expand Down

0 comments on commit 30d212a

Please sign in to comment.