Morbit
The package Morbit.jl
provides a local derivative-free solver for multiobjective optimization problems with possibly expensive objectives. It is meant to find a single Pareto-critical point, not a good covering of the global Pareto Set.
“Morbit” stands for Multiobjective Optimization by Radial Basis Function Interpolation in Trust-regions. The name was chosen so as to pay honors to the single objective algorithm ORBIT by Wild et. al.
We have a paper explaining the algorithm!
This was my first project using Julia and there have been many messy rewrites. Nonetheless, the solver should now work sufficiently well to tackle most problems. I hope to rewrite the custom types soonish. At the moment they are weakly typed and the performance suffers.
**To get started, see the examples, e.g. Two Parabolas.
This project was founded by the European Region Development Fund.
Morbit.RbfConfig
Morbit.TransformerFn
Morbit._add!
Morbit._backtrack
Morbit._del!
Morbit._get_shape_param
Morbit._init_model
Morbit._init_model
Morbit._intersect_bounds
Morbit._local_bounds
Morbit._multifactorial
Morbit._objf_index
Morbit._wrap_func
Morbit.add_objective!
Morbit.add_objective!
Morbit.add_objective!
Morbit.add_vector_objective!
Morbit.combine
Morbit.combine
Morbit.delete_surrogate!
Morbit.eval_all_objectives
Morbit.eval_and_sort_objectives
Morbit.eval_handle
Morbit.eval_models
Morbit.eval_models
Morbit.eval_models
Morbit.eval_objf
Morbit.find_box_independent_points1!
Morbit.find_points_in_box
Morbit.full_lower_bounds_internal
Morbit.full_upper_bounds_internal
Morbit.get_gradient
Morbit.get_gradient
Morbit.get_jacobian
Morbit.get_optim_handle
Morbit.get_optim_handle
Morbit.inc_evals!
Morbit.init_surrogates
Morbit.initialize_data
Morbit.load_config
Morbit.load_database
Morbit.load_iter_data
Morbit.local_bounds
Morbit.max_evals
Morbit.max_evals!
Morbit.model_cfg
Morbit.non_negative_solutions
Morbit.num_evals
Morbit.num_evals!
Morbit.num_objectives
Morbit.pop_objf!
Morbit.ps_polish_algo
Morbit.reset_evals!
Morbit.reverse_internal_sorting
Morbit.reverse_internal_sorting_indices
Morbit.save_config
Morbit.save_database
Morbit.save_database
Morbit.save_iter_data
Morbit.scale
Morbit.set_gradients!
Morbit.set_gradients!
Morbit.strict_backtracking
Morbit.unscale
Morbit.RbfConfig
— TypeRbfConfig(; kwarg1 = val1, … )
Configuration type for local RBF surrogate models.
To choose a kernel, use the kwarg kernel
and a value of either :cubic
(default), :multiquadric
, :exp
or :thin_plate_spline
. The kwarg shape_parameter
takes a constant number or a string that defines a calculation on Δ
, e.g, "Δ/10".
To see other configuration parameters use fieldnames(Morbit.RbfConfig)
. They have individual docstrings attached.
Morbit.TransformerFn
— MethodUnscale the point x̂
from internal to original domain.
Morbit._add!
— MethodAdd an objective function to MOP with specified output indices.
Morbit._backtrack
— MethodPerform a backtracking loop starting at x
with an initial step of step_size .* dir
and return trial point x₊
, the surrogate value-vector m_x₊
and the final step s = x₊ .- x
.
Morbit._del!
— MethodRemove an objective function from MOP.
Morbit._get_shape_param
— MethodGet real-valued shape parameter for RBF model from current iter data. cfg
allows for a string expression which would be evaluated here.
Morbit._init_model
— MethodReturn an ExactModel build from a VectorObjectiveFunction objf
. Model is the same inside and outside of criticality round.
Morbit._init_model
— MethodReturn a TaylorModel build from a VectorObjectiveFunction objf
.
Morbit._intersect_bounds
— MethodReturn smallest positive and biggest negative and σ₊
and σ₋
so that x .+ σ± .* d
stays within bounds.
Morbit._local_bounds
— MethodReturn lower and upper bound vectors combining global and trust region constraints.
Morbit._multifactorial
— MethodFactorial of a multinomial.
Morbit._objf_index
— MethodPosition of objf
in list_of_objectives(mop)
.
Morbit._wrap_func
— MethodA general constructor.
Morbit.add_objective!
— Functionadd_objective!( mop :: MixedMOP, func :: T where{T <: Function}, type :: Symbol = :expensive, n_out :: Int64 = 1, can_batch :: Bool = false )
Add scalar-valued objective function func
to mop
structure. func
must take an RVec
as its (first) argument, i.e. represent a function $f: ℝ^n → ℝ$. type
must either be :expensive
or :cheap
to determine whether the function is replaced by a surrogate model or not.
If type
is :cheap
and func
takes 1 argument only then its gradient is calculated by ForwardDiff. A cheap function func
with custom gradient function grad
(representing $∇f : ℝ^n → ℝ^n$) is added by
add_objective!(mop, func, grad)
The optional argument n_out
allows for the specification of vector-valued objective functions. This is mainly meant to be used for expensive functions that are in some sense inter-dependent.
The flag can_batch
defaults to false so that the objective function is simply looped over a bunch of arguments if required. If can_batch == true
then the objective function must be able to return an array of results when provided an array of input vectors (whilst still returning a single result, not a singleton array containing the result, for a single input vector).
Examples
# Define 2 scalar objective functions and a MOP ℝ^2 → ℝ^2
f1(x) = x[1]^2 + x[2]
f2(x) = exp(sum(x))
∇f2(x) = exp(sum(x)) .* ones(2);
mop = MixedMOP()
add_objective!(mop, f1, :cheap) # gradient will be calculated using ForwardDiff
add_objective!(mop, f2, ∇f2 ) # gradient is provided
Morbit.add_objective!
— Methodadd_objective!( mop :: MixedMOP, func :: T where{T <: Function}, grad :: T where{T <: Function})
Add scalar-valued objective function func
and its vector-valued gradient grad
to mop
struture.
Morbit.add_objective!
— MethodAdd a scalar objective to mop::MixedMOP
modelled according to model_config
.
Morbit.add_vector_objective!
— MethodAdd a vector objective to mop::MixedMOP
modelled according to model_config
.
Morbit.combine
— MethodCombine two objectives. Only needed if combinable
can return true.
Morbit.combine
— MethodGet a new function function handle stacking the output of func1
and func2
.
Morbit.delete_surrogate!
— MethodDelete surrogate wrapper at position si
from list sc.surrogates
.
Morbit.eval_all_objectives
— Method(Internally) Evaluate all objectives at site x̂::RVec
. Objective order might differ from order in which they were added.
Morbit.eval_and_sort_objectives
— MethodEvaluate all objectives at site x̂::RVec
and sort the result according to the order in which objectives were added.
Morbit.eval_handle
— MethodReturn a function that evaluates an objective at a scaled site.
Morbit.eval_models
— MethodEvaluate output ℓ
of the ExactModel em
at scaled site x̂
.
Morbit.eval_models
— MethodEvaluate the ExactModel em
at scaled site x̂
.
Morbit.eval_models
— MethodReturn model value for output l
of sc
at x̂
. Index l
is assumed to be an internal index in the range of 1,…,nobjfs, where nobjfs is the total number of (scalarized) objectives stored in sc
.
Morbit.eval_objf
— MethodEvaluate the objective at scaled site(s). and increase counter.
Morbit.find_box_independent_points1!
— MethodFind affinely independent results in database box of radius Δ
around x
Results are saved in rbf.tdata[tdata_index]
. Both rbf.Y
and rbf.Z
are changed.
Morbit.find_points_in_box
— MethodIndices of sites in database that lie in box with bounds lb
and ub
.
Morbit.full_lower_bounds_internal
— MethodReturn lower variable bounds for scaled variables.
Morbit.full_upper_bounds_internal
— MethodReturn upper variable bounds for scaled variables.
Morbit.get_gradient
— MethodGradient vector of output ℓ
of em
at scaled site x̂
.
Morbit.get_gradient
— MethodReturn a gradient for output l
of sc
at x̂
. Index 4
is assumed to be an internal index in the range of 1,…,nobjfs, where nobjfs is the total number of (scalarized) objectives stored in sc
.
Morbit.get_jacobian
— MethodJacobian Matrix of ExactModel em
at scaled site x̂
.
Morbit.get_optim_handle
— MethodReturn a function handle to be used with NLopt
for output l
of sc
. Index l
is assumed to be an internal index in the range of 1,…,nobjfs, where nobjfs is the total number of (scalarized) objectives stored in sc
.
Morbit.get_optim_handle
— MethodReturn a function handle to be used with NLopt
for output ℓ
of model
. That is, if model
is a surrogate for two scalar objectives, then ℓ
must be either 1 or 2.
Morbit.inc_evals!
— FunctionIncrease evaluation count by N
Morbit.init_surrogates
— MethodReturn a SurrogateContainer initialized from the information provided in mop
.
Morbit.initialize_data
— MethodPerform initialization of the data passed to optimize
function.
Morbit.load_config
— Methodload_config(fn :: AbstractString)
Load and return the AbstractConfig
that was saved previously with save_config
. Return nothing
on error.
Morbit.load_database
— Methodload_database(fn :: AbstractString)
Load and return the <:AbstractDB
that was saved previously with save_database
. Return nothing
on error.
Morbit.load_iter_data
— Methodload_iter_data(fn :: AbstractString)
Load and return the <:AbstractIterData
that was saved previously with save_iter_data
. Return nothing
on error.
Morbit.local_bounds
— MethodLocal bounds vectors lb_eff
and ub_eff
using scaled variable constraints from mop
.
Morbit.max_evals!
— MethodSet upper bound of № evaluations to N
Morbit.max_evals
— Method(Soft) upper bound on the number of function calls.
Morbit.model_cfg
— MethodReturn surrogate configuration used to model the objective internally.
Morbit.non_negative_solutions
— MethodReturn array of solution vectors [x1, …, xlen] to the equation $x_1 + … + x_len = rhs$ where the variables must be non-negative integers.
Morbit.num_evals!
— MethodSet evaluation counter to N
.
Morbit.num_evals
— MethodNumber of calls to the original objective function.
Morbit.num_objectives
— MethodNumber of scalar-valued objectives of the problem.
Morbit.pop_objf!
— MethodRemove objf
from list_of_objectives(mop)
and return its output indices.
Morbit.ps_polish_algo
— MethodSpecify local algorithm to polish Pascoletti-Serafini solution. Uses 1/4 of maximum allowed evals.
Morbit.reset_evals!
— MethodSet evaluation counter to 0 for each VectorObjectiveFunction in m.vector_of_objectives
.
Morbit.reverse_internal_sorting
— MethodSort an interal objective vector so that the objectives are in the order in which they were added.
Morbit.reverse_internal_sorting_indices
— MethodReturn index vector so that an internal objective vector is sorted according to the order the objectives where added.
Morbit.save_config
— Methodsave_config(filename, ac :: AbstractConfig )
Save the configuration object ac
at path filename
. Ensures, that the file extension is .jld2
. The fieldname to retrieve the database object is database
.
Returns the save path if successful and nothing
else.
Morbit.save_database
— Methodsave_database(filename, DB :: AbstractDB )
Save the database DB
at path filename
. Ensures, that the file extension is .jld2
. The fieldname to retrieve the database object is database
.
Returns the save path if successful and nothing
else.
Morbit.save_database
— Methodsave_database(filename, id :: AbstractIterData )
Save the database that is referenced by db(id)
at path filename
. Ensures, that the file extension is .jld2
. The fieldname to retrieve the database object is database
.
Returns the save path if successful and nothing
else.
Morbit.save_iter_data
— Methodsave_iter_data(filename, id :: AbstractIterData )
Save the whole object id
at path filename
. Ensures, that the file extension is .jld2
. The fieldname to retrieve the database object is database
.
Returns the save path if successful and nothing
else.
Morbit.scale
— MethodScale variables fully constrained to a closed interval to [0,1] internally.
Morbit.set_gradients!
— MethodModify/initialize thec exact model mod
so that we can differentiate it later.
Morbit.set_gradients!
— MethodModify/initialize thec exact model mod
so that we can differentiate it later.
Morbit.strict_backtracking
— MethodRequire a descent in all model objective components. Applies only to backtracking descent steps, i.e., :steepest_descent.
Morbit.unscale
— MethodReverse scaling for fully constrained variables from [0,1] to their former domain.