API

This section documents all functions not documented elsewhere

SemioticOpt.iterationFunction
iteration(f::Function, a::GradientDescent)

One iteration of a on the function f.

This function is unexported.

source
iteration(f::Function, a::ProjectedGradientDescent)

Apply a to f, projected based on a.t.

source
iteration(obj::Function, alg::PairwiseGreedyOpt)

One iteration of the pairwise greedy optimization algorithm alg for objective obj.

Example

julia> using SemioticOpt
julia> using LinearAlgebra
julia> f(x, ixs, a, b) = -((a[ixs] .* x) ./ (x .+ b[ixs])) |> sum
julia> aa = Float64[1, 1, 1000, 1]
julia> bb = Float64[1, 1, 1, 1]
julia> f(x, ixs) = f(x, ixs, aa, bb)
julia> function makepgd(v)
           return ProjectedGradientDescent(;
               x=v,
               η=1e-1,
               hooks=[StopWhen((a; kws...) -> norm(SemioticOpt.x(a) - kws[:z]) < 1.0)],
               t=v -> σsimplex(v, 1)  # Project onto unit-simplex
           )
       end
julia> alg = PairwiseGreedyOpt(;
           kmax=4,
           x=zeros(4),
           xinit=zeros(4),
           f=f,
           a=makepgd,
           hooks=[StopWhen((a; kws...) -> kws[:f](kws[:z]) ≥ kws[:f](SemioticOpt.x(a)))]
       )
julia> c = 0.1  # per non-zero cost
julia> selection = x -> f(x, 1:length(x)) + c * length(SemioticOpt.nonzeroixs(x))
julia> z = SemioticOpt.iteration(selection, alg)
4-element Vector{Float64}:
 0.0
 0.0
 1.0
 0.0
source
SemioticOpt.fFunction

Getter for the stop-function.

source

Get the function to record data

source
f(g::PairwiseGreedyOpt)

The objective function of the inner loop.

source
SemioticOpt.hooksFunction
hooks(g::GradientDescent)

The hooks used by the algorithm.

source
hooks(g::PairwiseGreedyOpt)

The hooks used by the algorithm.

source
SemioticOpt.maybeminimize!Function
maybeminimize!(f::Function, a::OptAlgorithm, op::Function)

Minimize f using a, which calls op for updating a.x.

This function may be in-place. Don't use it directly unless you know what you're doing. This function is unexported.

Warning

If you don't provide any hook with the IsStoppingCondition trait, this will loop forever.

source
SemioticOpt.xFunction
x(g::GradientDescent)
x(g::GradientDescent, v)

The current best guess for the solution. If using the setter, v is the new value.

The setter is not in-place. See SemioticOpt.x!.

source
x(g::ProjectedGradientDescent)
x(g::ProjectedGradientDescent, v)

The current best guess for the solution. If using the setter, v is the new value.

The setter is not in-place. See SemioticOpt.x!.

source
x(g::PairwiseGreedyOpt)
x(g::PairwiseGreedyOpt, v)

The current best guess for the solution. If using the setter, v is the new value.

The setter is not in-place. See SemioticOpt.x!.

source