Compromise
Documentation for Compromise. There is not much here yet. Everything is still very much a work-in-progress.
Random Doc-Strings:
Compromise.AbstractAugmentedNondominatedSetCompromise.AbstractAugmentedSetElementCompromise.AlgorithmOptionsCompromise.MutableMOPCompromise.NonlinearFunctions.NonlinearParametricFunctionCompromise.SimpleValueCacheCompromise.add_function!Compromise.add_nl_eq_constraints!Compromise.add_nl_eq_constraints!Compromise.add_nl_eq_constraints!Compromise.add_nl_ineq_constraints!Compromise.add_nl_ineq_constraints!Compromise.add_nl_ineq_constraints!Compromise.add_objectives!Compromise.add_objectives!Compromise.add_objectives!Compromise.add_to_set!Compromise.all_elementsCompromise.diff_mod!Compromise.dominatesCompromise.eval_and_diff_mod!Compromise.eval_mod!Compromise.eval_mop!Compromise.get_identifierCompromise.intersect_boundCompromise.intersect_boxCompromise.intersect_intervalsCompromise.is_dominatedCompromise.is_dominated_byCompromise.is_nondominated_quicktestCompromise.is_staleCompromise.mark_stale!Compromise.prepare_for_set!Compromise.remove_stale_elements!Compromise.scalar_valCompromise.scale_eq!Compromise.set_identifier!Compromise.trust_region_bounds!Compromise.trust_region_bounds!Compromise.unconditionally_add_to_set!Compromise.unmark_stale!Compromise.var_bounds_validCompromise.vector_valsCompromise.@forwardCompromise.@ignoraiseCompromise.@ignorebreak
Compromise.NonlinearFunctions.NonlinearParametricFunction — TypeNonlinearParametricFunction(;
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 == trueimpliesgrads!(Dy, x, p), otherwiseDy = grads(x, p).hessians_iip == trueimplieshessians!(H, x, p), otherwiseH = hessians(x, p).func_and_grads_iip == trueimpliesfunc_and_grads!(y, Dy, x, p), otherwisey, Dy = func_and_grads(x, p).func_and_grads_and_hessians_iip == trueimpliesfunc_and_grads_and_hessians!(y, Dy, H, x, p), elsey, 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.
Compromise.AbstractAugmentedNondominatedSet — TypeA supertype for elements of type AbstractAugmentedSetElement.
Compromise.AbstractAugmentedSetElement — TypeA supertype for elements that have a vector composed of a scalar value and a vector.
Compromise.AlgorithmOptions — TypeAlgorithmOptions(; kwargs...)Configure the optimization by passing keyword arguments:
float_type::Type{T} where T<:AbstractFloatstep_config::Any: Configuration object for descent and normal step computation.scaler_cfg::Any: Configuration to determine variable scaling (if model supports it). Either:boxor:none.require_fully_linear_models::Boollog_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 belowstop_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 loopedstop_max_crit_loopstimes.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 tocrit_B * χ.crit_M::AbstractFloat: Criticality Routine runs untilΔ ≤ crit_M * χ.crit_alpha::AbstractFloat: Trust region shrinking factor in criticality loops.backtrack_in_crit_routine::Booldelta_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 smallerc_delta, the stricter the test.c_mu::AbstractFloat: Factor for normal step compatibility test. The smallerc_mu, the stricter the test for small radii.mu::AbstractFloat: Exponent for normal step compatibility test. The largermu, 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.
Compromise.MutableMOP — TypeMutableMOP(; 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.
Compromise.SimpleValueCache — TypeA struct holding values computed for or derived from an AbstractMOP.
Compromise.add_function! — Methodadd_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.
Compromise.add_nl_eq_constraints! — Functionadd_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.
Compromise.add_nl_eq_constraints! — Functionadd_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.
Compromise.add_nl_eq_constraints! — Functionadd_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.
Compromise.add_nl_ineq_constraints! — Functionadd_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.
Compromise.add_nl_ineq_constraints! — Functionadd_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.
Compromise.add_nl_ineq_constraints! — Functionadd_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.
Compromise.add_objectives! — Functionadd_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.
Compromise.add_objectives! — Functionadd_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.
Compromise.add_objectives! — Functionadd_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.
Compromise.add_to_set! — Methodadd_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.
Compromise.all_elements — MethodReturn an iterable object of all elements currently stored in ndset.
Compromise.diff_mod! — MethodEvaluate the model gradients of mod at x and store results in mod_vals::SurrogateValueArrays.
Compromise.dominates — Methoddominates(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.
Compromise.eval_and_diff_mod! — MethodEvaluate and differentiate mod at x and store results in mod_vals::SurrogateValueArrays.
Compromise.eval_mod! — Methodeval_mod!(mod_cache::AbstractMOPSurrogateCache, mod::AbstractMOPSurrogate, x)Evaluate mod at x and update cache mod_cache.
Compromise.eval_mop! — MethodEvaluate mop at unscaled site ξ and modify result arrays in place.
Compromise.get_identifier — MethodReturn a human-readable identifier for elem.
Compromise.intersect_bound — Methodintersect_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.
Compromise.intersect_box — Methodintersect_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.
Compromise.intersect_intervals — FunctionHelper to intersect to intervals.
Compromise.is_dominated — Methodis_dominated(elem::AbstractSetElement, ndset::AbstractNondominatedSet)Return true if elem is dominated by any element in ndset.
Compromise.is_dominated_by — Methodisdominatedby(a, b) Return true, if b .<= a and b[k] < a[k] for some index k.
Compromise.is_nondominated_quicktest — Methodis_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.
Compromise.is_stale — MethodReturn true if elem is marked as “stale” in ndset.
Compromise.mark_stale! — MethodMark elem as “stale” in ndset.
Compromise.prepare_for_set! — MethodModify elem before adding it to ndset.
Compromise.remove_stale_elements! — MethodDelete stale elements from ndset.
Compromise.scalar_val — MethodReturn the scalar value for elem.
Compromise.scale_eq! — MethodMake Aξ ? b applicable in scaled domain.
Compromise.set_identifier! — MethodSet the identifier for elem to i.
Compromise.trust_region_bounds! — Methodtrust_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.
Compromise.trust_region_bounds! — Methodtrust_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.
Compromise.unconditionally_add_to_set! — MethodAdd elem to ndset without checking for dominance or removing any other elements.
Compromise.unmark_stale! — MethodRemove mark from elem in ndset.
Compromise.var_bounds_valid — Method`var_bounds_valid(lb, ub)`Return true if lower bounds lb and upper bounds ub are consistent.
Compromise.vector_vals — MethodReturn the vector of values for elem.
Compromise.@forward — Macro@forward WrapperType.wrapped_obj fnname(arg1, fwarg::WrapperType, args...; kwargs...)Defines a new method for fnname forwarding to method dispatching on wrapped_obj.
Compromise.@ignoraise — Macro@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_varThe indent expression must evaluate to an Int.
Compromise.@ignorebreak — Macro@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.