Documentation ¶
Overview ¶
Package optimization helps to find better configuration of your service or library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidParameterCombination notifies optimizer about invalid combination of parameters. // CostFunction must return MaxCost and ErrInvalidParameterCombination if it happened. ErrInvalidParameterCombination = errors.New("invalid parameter combination") // ErrTooHighInvalidParameterCombinationCost is returned when one sets too high // InvalidParameterCombinationCost setting ErrTooHighInvalidParameterCombinationCost = errors.New( "too high value of InvalidParameterCombinationCost: " + "visit https://github.com/coin-or/rbfopt/issues/28#issuecomment-629720480 to pick a good one") // ErrTooLowInvalidParameterCombinationCost is returned when one sets too low // InvalidParameterCombinationCost setting ErrTooLowInvalidParameterCombinationCost = errors.New( "observed cost value is higher than invalid parameter combination cost", ) )
var ErrUnknownInitStrategy = errors.New("unknown strategy")
ErrUnknownInitStrategy is returned when user set unknown InitStrategy
var ErrUnknownInvalidParameterCombinationRenderPolicy = errors.New("unknown InvalidParameterCombinationRenderPolicy")
ErrUnknownInvalidParameterCombinationRenderPolicy notifies about wrong InvalidParameterCombinationRenderPolicy value
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.5.0
type Config struct { // RBFOpt - config of rbfopt library itself RBFOpt *RBFOptConfig `json:"rbfopt"` //nolint:tagliatelle // RBFOpt is a well-known name, no underscore is needed // PlotConfig - config of plots made by wrapper Plot *PlotConfig `json:"plot"` // RootDir - place to store reports and other things // (optimizer will create it if it doesn't exist). RootDir string `json:"root_dir"` // Endpoint for the server that will work as a middleware Endpoint string `json:"endpoint"` }
Config is top level configuration
type ConfigModifier ¶
type ConfigModifier func(int)
ConfigModifier injects parameter value received from the optimizer into configuration instance.
type CostFunction ¶
CostFunction (or objective function) is implemented by clients. Optimizer will try to find the best possible combination of your parameters on the basis of this function. CostFunction call is expected to be expensive, so client should check context expiration.
type InitStrategy ¶
type InitStrategy int8
InitStrategy determines the way RBFOpt selects the initial sample points: See: 1. https://github.com/coin-or/rbfopt/blob/4.2.3/src/rbfopt/rbfopt_settings.py#L119 2. Https://usermanual.wiki/Document/manual.890598645/view (part 2.1)
const ( // LHDMaximin - the default init strategy LHDMaximin InitStrategy = iota // LHDCorr - one of possible init strategies LHDCorr // AllCorners - one of possible init strategies AllCorners // LowerCorners - one of possible init strategies LowerCorners // RandCorners - one of possible init strategies RandCorners )
func (InitStrategy) MarshalJSON ¶
func (s InitStrategy) MarshalJSON() ([]byte, error)
MarshalJSON renders InitStrategy to JSON.
type InvalidParameterCombinationRenderPolicy ¶ added in v0.5.0
type InvalidParameterCombinationRenderPolicy int8
InvalidParameterCombinationRenderPolicy defines how to handle points corresponding to the ErrInvalidParameterCombination on plots
const ( // Omit - points corresponding to the ErrInvalidParameterCombination won't be rendered at all Omit InvalidParameterCombinationRenderPolicy = iota + 1 // AssignClosestValidValue - points corresponding to the ErrInvalidParameterCombination // will be rendered as if they have max observed valid value AssignClosestValidValue )
func (InvalidParameterCombinationRenderPolicy) MarshalJSON ¶ added in v0.5.0
func (p InvalidParameterCombinationRenderPolicy) MarshalJSON() ([]byte, error)
MarshalJSON renders InvalidParameterCombinationRenderPolicy to JSON
func (InvalidParameterCombinationRenderPolicy) String ¶ added in v0.5.0
func (i InvalidParameterCombinationRenderPolicy) String() string
type ParameterDescription ¶
type ParameterDescription struct { Bound *Bound `json:"bound"` ConfigModifier ConfigModifier `json:"-"` Name string `json:"name"` }
ParameterDescription is something you want to optimization in your service configuration.
type ParameterValue ¶
ParameterValue describes some value of a CostFunction argument.
type PlotConfig ¶ added in v0.5.0
type PlotConfig struct { ScatterPlotPolicy InvalidParameterCombinationRenderPolicy `json:"scatter_plot_policy"` HeatmapRenderPolicy InvalidParameterCombinationRenderPolicy `json:"heatmap_render_policy"` }
PlotConfig - plot renderer configuration
func (*PlotConfig) String ¶ added in v0.5.0
func (c *PlotConfig) String() string
type RBFOptConfig ¶ added in v0.5.0
type RBFOptConfig struct { CostFunction CostFunction `json:"-"` // CostFunction itself Parameters []*ParameterDescription `json:"parameters"` // Arguments of a CostFunctions MaxEvaluations uint `json:"max_evaluations"` // Evaluations limit MaxIterations uint `json:"max_iterations"` // Iterations limit InitStrategy InitStrategy `json:"init_strategy"` // Strategy to select initial points // RBFOpt: reason: https://github.com/coin-or/rbfopt/issues/28 InvalidParameterCombinationCost Cost `json:"invalid_parameter_combination_cost"` }
RBFOptConfig - RBFOpt configuration
type Report ¶
type Report struct { Optimum []*ParameterValue `json:"optimum"` // Parameter values matching the optimum point Cost Cost `json:"cost"` // Discovered optimal value of a CostFunction Iterations int `json:"iterations"` Evaluations int `json:"evaluations"` FastEvaluations int `json:"fast_evaluations"` }
Report contains information about the finished optimization process