Skip to content

Multistart optimization #57

@amostof

Description

@amostof

Hello,

I have a multistart optimization code that generates initial parameter guesses initialps as you can see below and later used every row of them to solve a new optimization problem.

using Distributions, LatinHypercubeSampling, Statistics
p = convert(Array{Float64,1}, 1:3)
bounds = [Vector{Float64}(undef,2) for _ in 1:length(p)]
searchgrid = [1E-9, 1E-1]
for (ipara,para) in enumerate(p)
  bounds[ipara][1] = para * searchgrid[1]
  bounds[ipara][2] = para * searchgrid[2]
end

function latinCube(bounds, dims, nguess = 100)  
    initialps = []
    plan, _ = LHCoptim(nguess, dims, 1000)
    plan /= nguess
    
    for i in 1:dims
        append!(initialps, [quantile(LogUniform(bounds[i][1], bounds[i][2]), plan[:,i])])
    end
    return permutedims(hcat(initialps...))
end

nguess = 100
initialps = latinCube(bounds, length(p), nguess)

My problem is that I do not know how to implement it on p when it is a named tuple in the format of,

p = (p₁ = 1., p₂ = fixed(2.), p₃ = bounded(3., 0, 100))

So my question is how I can do multistart optimization using ParameterHandling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions