Compromise

Documentation for Compromise. There is not much here yet. Everything is still very much a work-in-progress.

Random Doc-Strings:

Compromise.NonlinearFunctions.NonlinearParametricFunctionType
NonlinearParametricFunction(; 
    func, grads=nothing, hessians=nothing, 
    func_and_grads=nothing, func_and_grads_and_hessians=nothing,
    backend=nothing,
    func_iip=true, grads_iip=true, hessians_iip=true, 
    func_and_grads_iip=true, func_and_grads_and_hessians_iip=true)

A flexible function wrapper to conveniently query evaluations and derivatives of user provided functions.

If the user provided function is used in a derivative-free alogrithm, only func has to be provided. The flag func_iip indicates its signature: If func_iip==true, the function should mutate the target array and have signature func!(y, x, p). Otherwise, y = func(x, p).

Should gradients be needed, function handles can be provided, and the respective flags indicate the following signatures:

  • grads_iip == true implies grads!(Dy, x, p), otherwise Dy = grads(x, p).
  • hessians_iip == true implies hessians!(H, x, p), otherwise H = hessians(x, p).
  • func_and_grads_iip == true implies func_and_grads!(y, Dy, x, p), otherwise y, Dy = func_and_grads(x, p).
  • func_and_grads_and_hessians_iip == true implies func_and_grads_and_hessians!(y, Dy, H, x, p), else y, Dy, H = func_and_grads_and_hessians(x, p).

Alternatively (or additionally), an AbstractAutoDiffBackend can be passed to compute the derivatives if the relevant field isnothing.

source
Compromise.AlgorithmOptionsType
AlgorithmOptions(; kwargs...)

Configure the optimization by passing keyword arguments:

  • float_type::Type{T} where T<:AbstractFloat

  • step_config::Any: Configuration object for descent and normal step computation.

  • scaler_cfg::Any: Configuration to determine variable scaling (if model supports it). Either :box or :none.

  • require_fully_linear_models::Bool

  • log_level::Base.CoreLogging.LogLevel: Control verbosity by setting a min. level for @logmsg.

  • max_iter::Int64: Maximum number of iterations.

  • stop_delta_min::Compromise.NumberWithDefault{T} where T<:AbstractFloat: Stop if the trust region radius is reduced to below stop_delta_min.

  • stop_xtol_rel::AbstractFloat: Stop if the trial point $xₜ$ is accepted and $‖xₜ - x‖≤ δ‖x‖$.

  • stop_xtol_abs::AbstractFloat: Stop if the trial point $xₜ$ is accepted and $‖xₜ - x‖≤ ε$.

  • stop_ftol_rel::AbstractFloat: Stop if the trial point $xₜ$ is accepted and $‖f(xₜ) - f(x)‖≤ δ‖f(x)‖$.

  • stop_ftol_abs::AbstractFloat: Stop if the trial point $xₜ$ is accepted and $‖f(xₜ) - f(x)‖≤ ε$.

  • stop_crit_tol_abs::AbstractFloat: Stop if for the approximate criticality it holds that $χ̂(x) <= ε$ and for the feasibility that $θ <= δ$.

  • stop_theta_tol_abs::Compromise.NumberWithDefault{T} where T<:AbstractFloat: Stop if for the approximate criticality it holds that $χ̂(x) <= ε$ and for the feasibility that $θ <= δ$.

  • stop_max_crit_loops::Int64: Stop after the criticality routine has looped stop_max_crit_loops times.

  • eps_crit::AbstractFloat: Lower bound for criticality before entering Criticality Routine.

  • eps_theta::AbstractFloat: Lower bound for feasibility before entering Criticality Routine.

  • crit_B::AbstractFloat: At the end of the Criticality Routine the radius is possibly set to crit_B * χ.

  • crit_M::AbstractFloat: Criticality Routine runs until Δ ≤ crit_M * χ.

  • crit_alpha::AbstractFloat: Trust region shrinking factor in criticality loops.

  • backtrack_in_crit_routine::Bool

  • delta_init::AbstractFloat: Initial trust region radius.

  • delta_max::AbstractFloat: Maximum trust region radius.

  • gamma_shrink_much::AbstractFloat: Most severe trust region reduction factor.

  • gamma_shrink::AbstractFloat: Trust region reduction factor.

  • gamma_grow::AbstractFloat: Trust region enlargement factor.

  • trial_mode::Union{Val{:max_diff}, Val{:min_rho}, Val{:max_rho}}: Whether to require all objectives to be reduced or not.

  • nu_accept::AbstractFloat: Acceptance threshold.

  • nu_success::AbstractFloat: Success threshold.

  • trial_update::Union{Val{:classic}, Val{:stepsize}}

  • c_delta::AbstractFloat: Factor for normal step compatibility test. The smaller c_delta, the stricter the test.

  • c_mu::AbstractFloat: Factor for normal step compatibility test. The smaller c_mu, the stricter the test for small radii.

  • mu::AbstractFloat: Exponent for normal step compatibility test. The larger mu, the stricter the test for small radii.

  • kappa_theta::AbstractFloat: Factor in the model decrease condition.

  • psi_theta::AbstractFloat: Exponent (for constraint violation) in the model decrease condition.

source
Compromise.MutableMOPType
MutableMOP(; num_vars, kwargs...)

Initialize a multi-objective problem with num_vars variables.

Functions

There can be exactly one (possibly vector-valued) objective function, one nonlinear equality constraint function, and one nonlinear inequality constraint function. For now, they have to be of type NonlinearFunction. You could provide these functions with the keyword-arguments objectives, nl_eq_constraints or nl_ineq_constraints or set the fields of the same name. To conveniently add user-provided functions, there are helper functions, like add_objectives!.

LinearConstraints

Box constraints are defined by the vectors lb and ub. Linear equality constraints $Ex=c$ are defined by the matrix E and the vector c. Inequality constraints read $Ax≤b$ and use A and b.

Surrogate Configuration

Use the keyword-arguments mcfg_objectives to provide an AbstractSurrogateModelConfig to define how the objectives should be modelled. By default, we assume ExactModelConfig(), which requires differentiable objectives.

source
Compromise.add_function!Method
add_function!(func_field, mop, op, model_cfg; dim_out, backend=NoBackend())

Add the operator op to mop at func_field and use model configuration model_cfg. Keyword argument dim_out::Int is mandatory. E.g., add_function!(:objectives, mop, op, :rbf; dim_out=2) adds op as the bi-valued objective to mop.

source
Compromise.add_nl_eq_constraints!Function
add_nl_eq_constraints!(mop::MutableMOP, func, grads, model_cfg=nothing; 
    dim_out::Int, kwargs...)

Set function func to return the nonlinear equality constraints vector of mop. Argument model_cfg is optional and specifies the surrogate models for func. Can be nothing, a Symbol (:exact, :rbf, taylor1, taylor2), or an AbstractSurrogateModelConfig object. grads should be a function mapping a vector to the transposed jacobian of func.

All functions can be in-place, see keyword arguments func_iip and grads_iip.

Keyword argument dim_out is mandatory and corresponds to the length of the result vector. The other kwargs... are passed to the inner AbstractNonlinearOperator as is. For options and defaults see NonlinearParametricFunction.

source
Compromise.add_nl_eq_constraints!Function
add_nl_eq_constraints!(mop::MutableMOP, func, grads, func_and_grads, model_cfg=nothing; 
    dim_out::Int, kwargs...)

Set function func to return the nonlinear equality constraints vector of mop. Argument model_cfg is optional and specifies the surrogate models for func. Can be nothing, a Symbol (:exact, :rbf, taylor1, taylor2), or an AbstractSurrogateModelConfig object. grads should be a function mapping a vector to the transposed jacobian of func, while func_and_grads returns a primal vector and the gradients at the same time.

All functions can be in-place, see keyword arguments func_iip, grads_iip and func_and_grads_iip.

Keyword argument dim_out is mandatory and corresponds to the length of the result vector. The other kwargs... are passed to the inner AbstractNonlinearOperator as is. For options and defaults see NonlinearParametricFunction.

source
Compromise.add_nl_eq_constraints!Function
add_nl_eq_constraints!(mop::MutableMOP, func, model_cfg=nothing; 
    dim_out::Int, kwargs...)

Set function func to return the nonlinear equality constraints vector of mop. Argument model_cfg is optional and specifies the surrogate models for func. Can be nothing, a Symbol (:exact, :rbf, taylor1, taylor2), or an AbstractSurrogateModelConfig object.

All functions can be in-place, see keyword argument func_iip.

Keyword argument dim_out is mandatory and corresponds to the length of the result vector. If dim_vars(mop) <= 0, then dim_in is also mandatory. The other kwargs... are passed to the inner AbstractNonlinearOperator as is. For options and defaults see NonlinearParametricFunction.

source
Compromise.add_nl_ineq_constraints!Function
add_nl_ineq_constraints!(mop::MutableMOP, func, grads, model_cfg=nothing; 
    dim_out::Int, kwargs...)

Set function func to return the nonlinear inequality constraints vector of mop. Argument model_cfg is optional and specifies the surrogate models for func. Can be nothing, a Symbol (:exact, :rbf, taylor1, taylor2), or an AbstractSurrogateModelConfig object. grads should be a function mapping a vector to the transposed jacobian of func.

All functions can be in-place, see keyword arguments func_iip and grads_iip.

Keyword argument dim_out is mandatory and corresponds to the length of the result vector. The other kwargs... are passed to the inner AbstractNonlinearOperator as is. For options and defaults see NonlinearParametricFunction.

source
Compromise.add_nl_ineq_constraints!Function
add_nl_ineq_constraints!(mop::MutableMOP, func, grads, func_and_grads, model_cfg=nothing; 
    dim_out::Int, kwargs...)

Set function func to return the nonlinear inequality constraints vector of mop. Argument model_cfg is optional and specifies the surrogate models for func. Can be nothing, a Symbol (:exact, :rbf, taylor1, taylor2), or an AbstractSurrogateModelConfig object. grads should be a function mapping a vector to the transposed jacobian of func, while func_and_grads returns a primal vector and the gradients at the same time.

All functions can be in-place, see keyword arguments func_iip, grads_iip and func_and_grads_iip.

Keyword argument dim_out is mandatory and corresponds to the length of the result vector. The other kwargs... are passed to the inner AbstractNonlinearOperator as is. For options and defaults see NonlinearParametricFunction.

source
Compromise.add_nl_ineq_constraints!Function
add_nl_ineq_constraints!(mop::MutableMOP, func, model_cfg=nothing; 
    dim_out::Int, kwargs...)

Set function func to return the nonlinear inequality constraints vector of mop. Argument model_cfg is optional and specifies the surrogate models for func. Can be nothing, a Symbol (:exact, :rbf, taylor1, taylor2), or an AbstractSurrogateModelConfig object.

All functions can be in-place, see keyword argument func_iip.

Keyword argument dim_out is mandatory and corresponds to the length of the result vector. If dim_vars(mop) <= 0, then dim_in is also mandatory. The other kwargs... are passed to the inner AbstractNonlinearOperator as is. For options and defaults see NonlinearParametricFunction.

source
Compromise.add_objectives!Function
add_objectives!(mop::MutableMOP, func, grads, model_cfg=nothing; 
    dim_out::Int, kwargs...)

Set function func to return the objectives vector of mop. Argument model_cfg is optional and specifies the surrogate models for func. Can be nothing, a Symbol (:exact, :rbf, taylor1, taylor2), or an AbstractSurrogateModelConfig object. grads should be a function mapping a vector to the transposed jacobian of func.

All functions can be in-place, see keyword arguments func_iip and grads_iip.

Keyword argument dim_out is mandatory and corresponds to the length of the result vector. The other kwargs... are passed to the inner AbstractNonlinearOperator as is. For options and defaults see NonlinearParametricFunction.

source
Compromise.add_objectives!Function
add_objectives!(mop::MutableMOP, func, grads, func_and_grads, model_cfg=nothing; 
    dim_out::Int, kwargs...)

Set function func to return the objectives vector of mop. Argument model_cfg is optional and specifies the surrogate models for func. Can be nothing, a Symbol (:exact, :rbf, taylor1, taylor2), or an AbstractSurrogateModelConfig object. grads should be a function mapping a vector to the transposed jacobian of func, while func_and_grads returns a primal vector and the gradients at the same time.

All functions can be in-place, see keyword arguments func_iip, grads_iip and func_and_grads_iip.

Keyword argument dim_out is mandatory and corresponds to the length of the result vector. The other kwargs... are passed to the inner AbstractNonlinearOperator as is. For options and defaults see NonlinearParametricFunction.

source
Compromise.add_objectives!Function
add_objectives!(mop::MutableMOP, func, model_cfg=nothing; 
    dim_out::Int, kwargs...)

Set function func to return the objectives vector of mop. Argument model_cfg is optional and specifies the surrogate models for func. Can be nothing, a Symbol (:exact, :rbf, taylor1, taylor2), or an AbstractSurrogateModelConfig object.

All functions can be in-place, see keyword argument func_iip.

Keyword argument dim_out is mandatory and corresponds to the length of the result vector. If dim_vars(mop) <= 0, then dim_in is also mandatory. The other kwargs... are passed to the inner AbstractNonlinearOperator as is. For options and defaults see NonlinearParametricFunction.

source
Compromise.add_to_set!Method
add_to_set!(ndset, elem; check_elem=true, log_level=Info, indent=0, kwargs...)

Add elem to ndset and remove dominated elements. If check_elem==true, we ensure that it is not dominated by ndset before taking action.

source
Compromise.diff_mod!Method

Evaluate the model gradients of mod at x and store results in mod_vals::SurrogateValueArrays.

source
Compromise.dominatesMethod
dominates(elem_test::AbstractSetElement, elem_compare::AbstractSetElement)

Return true, if elem_test dominates (is less or equal than) elem_compare. An element should not dominate itself.

source
Compromise.eval_mod!Method
eval_mod!(mod_cache::AbstractMOPSurrogateCache, mod::AbstractMOPSurrogate, x)

Evaluate mod at x and update cache mod_cache.

source
Compromise.intersect_boundMethod
intersect_bound(xi, zi, bi)

Given number xi, zi and bi, compute and return an interval I (a tuple with 2 elements) such that xi + σ * zi <= bi is true for all σ in I. If the constraint is feasible, at least one of the interval elements is infinite. If it is infeasible, (NaN, NaN) is returned.

source
Compromise.intersect_boxMethod
intersect_box(x, z, lb, ub)

Given vectors x, z, lb and ub, compute and return the largest interval I (a tuple with 2 elements) such that lb .<= x .+ σ .* z .<= ub is true for all σ in I. If the constraints are not feasible, (NaN, NaN) is returned. If the direction z is zero, the interval could contain infinite elements.

source
Compromise.is_dominatedMethod
is_dominated(elem::AbstractSetElement, ndset::AbstractNondominatedSet)

Return true if elem is dominated by any element in ndset.

source
Compromise.is_nondominated_quicktestMethod
is_nondominated_quicktest(
    elem::AbstractSetElement, ndset::AbstractNondominatedSet)

Before iterating all objects of ndset, perform a pre-check of elem and return true if elem is not dominated.

source
Compromise.trust_region_bounds!Method
trust_region_bounds!(lb, ub, x, Δ)

Make lb the lower left corner of a trust region hypercube with radius Δ and make ub the upper right corner.

source
Compromise.trust_region_bounds!Method
trust_region_bounds!(lb, ub, x, Δ, global_lb, global_ub)

Make lb the lower left corner of a trust region hypercube with radius Δ and make ub the upper right corner. global_lb and global_ub are the global bound vectors or nothing.

source
Compromise.@forwardMacro
@forward WrapperType.wrapped_obj fnname(arg1, fwarg::WrapperType, args...; kwargs...)

Defines a new method for fnname forwarding to method dispatching on wrapped_obj.

source
Compromise.@ignoraiseMacro
@ignoraise a, b, c = critical_function(args...) [indent=0]

Evaluate the right-hand side. If it returns an AbstractStoppingCriterion, make sure it is wrapped and return it. Otherwise, unpack the returned values into the left-hand side.

Also valid:

@ignoraise critical_function(args...)
@ignoraise critical_function(args...) indent_var

The indent expression must evaluate to an Int.

source
Compromise.@ignorebreakMacro
@ignorebreak ret_var = critical_function(args...)

Similar to @ignoraise, but instead of returning if critical_function returns an AbstractStoppingCriterion, we break. This allows for post-processing before eventually returning. ret_var is optional, but in constrast to @ignoraise, we unpack unconditionally, so length of return values should match length of left-hand side expression.

source