Skip to content

Commit 30d212a

Browse files
committed
minor refactor
1 parent f76af4d commit 30d212a

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NonconvexMultistart"
22
uuid = "11b12826-7e46-4acf-9706-be0a67f2add7"
33
authors = ["Mohamed Tarek <[email protected]> and contributors"]
4-
version = "0.1.3"
4+
version = "0.1.4"
55

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

1616
[compat]
17-
ChainRulesCore = "0.10, 1"
17+
ChainRulesCore = "1"
1818
Hyperopt = "0.4"
1919
NonconvexCore = "1"
20-
Parameters = "0.12"
20+
Parameters = "0.12, 0.13"
2121
Reexport = "1"
22-
Setfield = "0.7, 0.8, 1"
22+
Setfield = "1"
2323
Sobol = "1"
2424
julia = "1"
2525

src/NonconvexMultistart.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Hyperopt
77
using Reexport, Parameters, Setfield, ChainRulesCore, Sobol
88
@reexport using NonconvexCore
99
using NonconvexCore:
10-
reset!, isfeasible, @params, VecModel, AbstractOptimizer, AbstractResult
10+
reset!, isfeasible, VecModel, AbstractOptimizer, AbstractResult
1111
import NonconvexCore: optimize!, Workspace
1212

1313
include("hyperopt.jl")

src/hyperopt.jl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@params struct HyperoptAlg <: AbstractOptimizer
2-
sub_alg::AbstractOptimizer
1+
struct HyperoptAlg{S <: AbstractOptimizer} <: AbstractOptimizer
2+
sub_alg::S
33
end
44

55
"""
@@ -15,14 +15,14 @@ end
1515
- `ctol`: infeasibility tolerance for accepting a solution as feasible
1616
- `keep_all`: if true, all the solutions of the sub-problems will be saved
1717
"""
18-
@params struct HyperoptOptions
19-
sub_options::Any
20-
lb::Any
21-
ub::Any
22-
searchspace_size::Integer
23-
iters::Integer
24-
sampler::Hyperopt.Sampler
25-
ctol::Any
18+
struct HyperoptOptions{S1, L, U, S2 <: Hyperopt.Sampler, C}
19+
sub_options::S1
20+
lb::L
21+
ub::U
22+
searchspace_size::Int
23+
iters::Int
24+
sampler::S2
25+
ctol::C
2626
keep_all::Bool
2727
end
2828
function HyperoptOptions(;
@@ -47,10 +47,10 @@ function HyperoptOptions(;
4747
)
4848
end
4949

50-
@params struct HyperoptWorkspace <: Workspace
51-
sub_workspace::Workspace
52-
x0::AbstractVector
53-
options::HyperoptOptions
50+
struct HyperoptWorkspace{S <: Workspace, X <: AbstractVector, O <: HyperoptOptions} <: Workspace
51+
sub_workspace::S
52+
x0::X
53+
options::O
5454
end
5555

5656
function Workspace(
@@ -78,11 +78,11 @@ When using multiple x0 in [`optimize`](@ref), return this result, including foll
7878
- `results`: all the search results.
7979
- `optimal_ind`: the index of the optimal solution in `results`.
8080
"""
81-
@params struct HyperoptResult <: AbstractResult
82-
minimum::Any
83-
minimizer::Any
84-
results::Any
85-
optimal_ind::Any
81+
struct HyperoptResult{M1, M2, R, O} <: AbstractResult
82+
minimum::M1
83+
minimizer::M2
84+
results::R
85+
optimal_ind::O
8686
end
8787

8888
function optimize!(workspace::HyperoptWorkspace)

0 commit comments

Comments
 (0)