Public API
These functions and types implement the API of DirectSearch.jl.
Problem Configuration
DirectSearch.DSProblem — TypeDSProblem{T}(N::Int; poll::AbstractPoll=LTMADS{T}(),
search::AbstractSearch=NullSearch(),
objective::Union{Function,Nothing}=nothing,
initial_point::Vector{T}=zeros(T, N),
iteration_limit::Int=1000,
sense::ProblemSense=Min)Return a problem definition for an N dimensional problem.
poll and search specify the poll and search step algorithms to use. The default choices are (LTMADS)[@ref] and (NullSearch)[@ref] respectively.
Note that if working with Float64 (normally the case) then the type parameterisation can be ignored.
DirectSearch.SetObjective — FunctionSetObjective(p::DSProblem, obj::Function)Sets the target objective function to solve. obj should take a vector and return a single cost value.
DirectSearch.SetInitialPoint — FunctionSetInitialPoint(p::DSProblem{T}, x::Vector{T}) where TSet the initial incumbent point to x. This must be of the correct dimension. If using any extreme barrier constraints then it must also satisfy these constraints.
DirectSearch.Optimize! — FunctionOptimize!(p::DSProblem)Run the direct search algorithm on problem p.
p must have had its initial point and objective function set. If extreme barrier constraints have been set then the initial point must be value for those constraints.
DirectSearch.SetIterationLimit — FunctionSetIterationLimit(p::DSProblem, i::Int)Set the maximum number of iterations to i.
DirectSearch.SetVariableRange — FunctionSetVariableRange(p::DSProblem{T}, index::Int, l::T, u::T) where TSet the expected range of the variable with index i to between lower (l) and upper (u) values. This does not create a constraint, and is only used for scaling when a variable varies with a significantly different scale to the others.
DirectSearch.SetVariableRanges — FunctionSetVariableRanges(p::DSProblem{T}, l::Vector{T}, u::Vector{T}) where TCall SetVariableRange for each variable. The vectors l and u should contain a lower and upper bound for each variable. If it is desired to keep a variable at default scaling, then give it upper and lower bounds of -5 and 5 respectively.
DirectSearch.BumpIterationLimit — FunctionBumpIterationLimit(p::DSProblem, val::Int=100)Increase the iteration limit by i.
Missing docstring for ProblemSense. Check Documenter's build log for details.
DirectSearch.SetMaxEvals — FunctionSetMaxEvals(p::DSProblem, m::Int)Set the maximum number of simultaneous function evaluations that can be run. By default this will be set 1.
If (DirectSearch.function_evaluation)[@ref] is not overriden (e.g. for sending calculation to a cluster) then setting this to a number greater than your PC's number of threads will result in no improvement.
Search Stages
DirectSearch.NullSearch — TypeNullSearch()Return no trial points for a search stage (ie, skips the search stage from running)
DirectSearch.RandomSearch — TypeRandomSearch(M::Int)Return M randomly chosen trial points from the current mesh.
Poll Stages
DirectSearch.LTMADS — TypeLTMADS()Return an empty LTMADS object.
LTMADS is a poll stage that creates a set of directions based on a semi-randomly generated lower triangular matrix. This randomness means that several runs of the algorithm may be needed to find a minimum.
DirectSearch.OrthoMADS — TypeOrthoMADS(N::Int)Return an empty OrthoMADS object. N must match the dimension of the problem that this stage is being given to.
OrthoMADS uses Halton sequences to generate an orthogonal basis of directiosn for the poll step. This is a deterministic process, unlike (LTMADS)[@ref].
Constraints
DirectSearch.AddExtremeConstraint — MethodAddExtremeConstraint(p::AbstractProblem, c::Function
index::CollectionIndex=CollectionIndex(1)
)::ConstraintIndex where TRegister a single function that defines an extreme barrier constraint. Return a constraint index.
The provided function should take a vector input and return a boolean or numeric value indicating if the constraint has been met or not. true or less than or equal to 0 indicates the constraint has been met. false or greater than 0 shows the constraint has been violated.
The index argument can be specified to give a collection to add the constraint to. The specified collection must exist, and must be able to accept extreme barrier constraints. If index is not specified then it is added to collection 1, the default extreme constraint collection.
DirectSearch.AddExtremeConstraint — MethodAddExtremeConstraint(p::AbstractProblem, c::Vector{Function}; index::CollectionIndex=CollectionIndex(1))Register a group of functions that define extreme barrier constraints. Calls AddExtremeConstraint on each function individually.
DirectSearch.AddProgressiveConstraint — MethodAddProgressiveConstraint(p::AbstractProblem, c::Function; index::CollectionIndex=CollectionIndex(2))Register a single function that defines a progressive barrier constraint. Return an index that refers to the constraint.
The provided function should take a vector input and return a numeric value indicating if the constraint has been met or not. Less than or equal to 0 indicates the constraint has been met. 0 shows the constraint has been violated.
The index argument can be specified to give a collection to add the constraint to. The specified collection must exist, and must be able to accept progressive barrier constraints. If index is not specified then it is added to collection 2, the default progressive barrier constraint collection.
DirectSearch.AddProgressiveConstraint — MethodAddProgressiveConstraint(p::AbstractProblem, c::Vector{Function})::Vector{Int}Register a group of functions that define progressive barrier constraints. Calls AddProgressiveConstraint on each function individually.
DirectSearch.AddExtremeCollection — MethodAddExtremeCollection(p::Constraints{T})::CollectionIndex where TInstantiate a new constraint collection for extreme constraints. Returns an index that refers to the new collection.
DirectSearch.AddProgressiveCollection — MethodAddProgressiveCollection(p::Constraints{T}; h_max=Inf, h_max_update::Function=h_max_update,
aggregator::Function=x->max(0,x)^2)::CollectionIndex where TInstantiate a new constraint collection within the problem. Returns an index that refers to this new collection.
The default constraint settings match those from Audet & Dennis 2009:
h_max: Begins as infinity
h_max_update: Sets h_max to the largest valid h evaluation if an iteration is improving
aggregator: Creates h as $\sum k(x)$ where $k=\max(0,x)^2$
DirectSearch.DefaultExtremeRef — ConstantDefaultExtremeRefThe collection index that refers to the default location of extreme barrier constraints.
DirectSearch.DefaultProgressiveRef — ConstantDefaultProgressiveRefThe collection index that refers to the default location of progressive barrier constraints.
Reporting
Many functions in this section are out of date, do not rely on them to give accurate information
DirectSearch.report_finish — Functionreport_finish(p::DSProblem)Not Implemented
If not silent, give a short printout of the result of the problem.
States the duration, final point, final cost, and reason for stopping. A more detailed report can be shown with report.
DirectSearch.report — Functionreport(p::DSProblem; save::Union{Bool,String}=false)Prints a summary of the problem to the console, or saves it as a text file.
save=true saves the report in the current REPL directory, but will error if the default file name report is taken. Otherwise give a path as an argument to use that name.
The report contains the solver configuration, the initial and final incumbent points, the initial and final cost, the duration, the number of iterations, and the current status.
DirectSearch.export_points — Functionexport_points(p::DSProblem)Gives the trace of considered points during optimisation. Note that this is unavailable if tracking of points has been disabled
Missing docstring for DirectSearch.ReportConstraints(::DSProblem). Check Documenter's build log for details.
Missing docstring for DirectSearch.ReportConstraintCollection. Check Documenter's build log for details.