Public API

These functions and types implement the API of DirectSearch.jl.

Problem Configuration

DirectSearch.DSProblem — Type
DSProblem{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.

source
DirectSearch.SetObjective — Function
SetObjective(p::DSProblem, obj::Function)

Sets the target objective function to solve. obj should take a vector and return a single cost value.

source
DirectSearch.SetInitialPoint — Function
SetInitialPoint(p::DSProblem{T}, x::Vector{T}) where T

Set 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.

source
DirectSearch.Optimize! — Function
Optimize!(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.

source
DirectSearch.SetVariableRange — Function
SetVariableRange(p::DSProblem{T}, index::Int, l::T, u::T) where T

Set 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.

source
DirectSearch.SetVariableRanges — Function
SetVariableRanges(p::DSProblem{T}, l::Vector{T}, u::Vector{T}) where T

Call 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.

source
Missing docstring.

Missing docstring for ProblemSense. Check Documenter's build log for details.

DirectSearch.SetMaxEvals — Function
SetMaxEvals(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.

source

Search Stages

Poll Stages

DirectSearch.LTMADS — Type
LTMADS()

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.

source
DirectSearch.OrthoMADS — Type
OrthoMADS(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].

source

Constraints

DirectSearch.AddExtremeConstraint — Method
AddExtremeConstraint(p::AbstractProblem, c::Function
                     index::CollectionIndex=CollectionIndex(1)
                    )::ConstraintIndex where T

Register 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.

source
DirectSearch.AddProgressiveConstraint — Method
AddProgressiveConstraint(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.

source
DirectSearch.AddExtremeCollection — Method
AddExtremeCollection(p::Constraints{T})::CollectionIndex where T

Instantiate a new constraint collection for extreme constraints. Returns an index that refers to the new collection.

source
DirectSearch.AddProgressiveCollection — Method
AddProgressiveCollection(p::Constraints{T}; h_max=Inf, h_max_update::Function=h_max_update, 
                         aggregator::Function=x->max(0,x)^2)::CollectionIndex where T

Instantiate 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$

source

Reporting

Many functions in this section are out of date, do not rely on them to give accurate information

DirectSearch.report_finish — Function
report_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.

source
DirectSearch.report — Function
report(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.

source
DirectSearch.export_points — Function
export_points(p::DSProblem)

Gives the trace of considered points during optimisation. Note that this is unavailable if tracking of points has been disabled

source
Missing docstring.

Missing docstring for DirectSearch.ReportConstraints(::DSProblem). Check Documenter's build log for details.

Missing docstring.

Missing docstring for DirectSearch.ReportConstraintCollection. Check Documenter's build log for details.