Optimization Test Functions#
This subpackage provides access to several engineered objective functions for testing optimization algorithms
Entries on this page:
Base Class for Test Functions#
Test Functions with Binary Input#
- class IsolatedBinaryOptimizationFunction(a, n)[source]#
Bases:
TestFunction
Note
This function is under development.
A test function for binary optimization defined on the following form
\[f(x) := \begin{cases} 10 n a ; x[: n//2] = n//2, x[n//2: ] = 0 10 n a ; x[: n//3] = n//3, x[n//3: ] = 0 - 10 n a ; x[: n//2] = 0, x[n//2: ] = n//2 - 10 n a ; x[: n//3] = 0, x[n//3: ] = n // 3 5 \lfloor \frac{n}/2 \rfloor - |x| * a ; & |x| > a \ 5 \lfloor \frac{n}/2 \rfloor -|x| * a ; & |x| < a \ 5 \lfloor \frac{n}/2 \rfloor * a ; & |x| = a \,, \end{cases}\]where :\(x\) is the variable, and :\(n\) is its (integer) dimension, and both :\(a\) and :\(n\) are parameters passed upon instantiation. Here, a is assumed to be a postive number.
The global maximum of this function is :\(2 n a\) achieved by two vectors, and the global minimum of this function is :\(-2 n a\) achieved by two vectors.
- Parm a:
positive number
- Parm n:
positive integer representing dimension of the domain/variable
- property global_maxima#
A list of one or more values of the random variable x with f(x) being the global maximum value.
- property global_minima#
A list of one or more values of the random variable x with f(x) being the global minimum value.
- class AlternatingSignOptimizationFunction(n)[source]#
Bases:
TestFunction
A weighting vector, of the same size as a passed vector x, is created on the form (1, -1, 1, -1, …). The weighting vector is pointwise multiplied by the passed vector and the objective is evaluated as the sum of the resulting vector. The global maximum (unique) is (1, 0, 1, 0, …) The global minimum (unique) is (0, 1, 0, 1, …) :parm n: positiveinteger representing dimension of the domain/variable
- property global_maxima#
A list of one or more values of the random variable x with f(x) being the global maximum value.
- property global_minima#
A list of one or more values of the random variable x with f(x) being the global minimum value.
- class WeightedAlternatingSignOptimizationFunction(n)[source]#
Bases:
TestFunction
A weighting vector, of the same size as a passed vector x, is created on the form (1, -2, 3, -4, …). The weighting vector is pointwise multiplied by the passed vector and the objective is evaluated as the sum of the resulting vector. The global maximum (unique) is (1, 0, 1, 0, …) The global minimum (unique) is (0, 1, 0, 1, …) :parm n: positiveinteger representing dimension of the domain/variable
- property global_maxima#
A list of one or more values of the random variable x with f(x) being the global maximum value.
- property global_minima#
A list of one or more values of the random variable x with f(x) being the global minimum value.
- class FacilityFunction(shape=None, M=None)[source]#
Bases:
TestFunction
Given a matrix \(M \in \mathbb{R}^{m \times n}\) with \(M_{i,j} \geq 0\), define the function
\[f(x) := \sum_{i=1}^m \max M[i, x]\]for any binary vector \(x\). This function is guaranteed to be submodular.