odatse.solver.analytical module#
- class odatse.solver.analytical.Solver(info: Info)[source]#
Bases:
SolverFunction Solver with pre-defined benchmark functions
Initialize the solver.
- Parameters:
info (Info) – Information object containing solver configuration.
- odatse.solver.analytical.ackley(xs: ndarray) float[source]#
Ackley’s function in arbitrary dimension
- Parameters:
xs (np.ndarray) – Input array.
- Returns:
The calculated value of Ackley’s function.
- Return type:
float
Notes
It has one global minimum f(xs)=0 at xs=[0,0,…,0]. It has many local minima.
- odatse.solver.analytical.alpine(xs: ndarray) float[source]#
Alpine function.
- Parameters:
xs (np.ndarray) – Input array.
- Returns:
The calculated value of the Alpine function.
- Return type:
float
Notes
It has a global minimum f(x)=0 at x=[0,0,…,0].
- odatse.solver.analytical.exponential(xs: ndarray) float[source]#
Exponential function.
- Parameters:
xs (np.ndarray) – Input array.
- Returns:
The calculated value of the Exponential function.
- Return type:
float
Notes
It has a global minimum f(x)=-1 at x=[0,0,…,0].
- odatse.solver.analytical.griewank(xs: ndarray) float[source]#
Griewank function.
- Parameters:
xs (np.ndarray) – Input array.
- Returns:
The calculated value of the Griewank function.
- Return type:
float
Notes
It has a global minimum f(x)=0 at x=[0,0,…,0].
- odatse.solver.analytical.himmelblau(xs: ndarray) float[source]#
Himmelblau’s function.
- Parameters:
xs (np.ndarray) – Input array of shape (2,).
- Returns:
The calculated value of Himmelblau’s function.
- Return type:
float
Notes
It has four global minima f(xs) = 0 at xs=[3,2], [-2.805118…, 3.131312…], [-3.779310…, -3.2831860], and [3.584428…, -1.848126…].
- odatse.solver.analytical.linear_regression_test(xs: ndarray) float[source]#
Negative log likelihood of linear regression with Gaussian noise N(0,sigma)
y = ax + b
trained by xdata = [1, 2, 3, 4, 5, 6] and ydata = [1, 3, 2, 4, 3, 5].
Model parameters (a, b, sigma) are corresponding to xs as the following, a = xs[0], b = xs[1], log(sigma**2) = xs[2]
It has a global minimum f(xs) = 1.005071.. at xs = [0.628571…, 0.8, -0.664976…].
- Parameters:
xs (np.ndarray) – Input array of model parameters.
- Returns:
The negative log likelihood of the linear regression model.
- Return type:
float
- odatse.solver.analytical.michalewicz(xs: ndarray) float[source]#
Michalewicz function.
- Parameters:
xs (np.ndarray) – Input array.
- Returns:
The calculated value of the Michalewicz function.
- Return type:
float
Notes
The global minimum value and location depend on the dimension. There are d! local minima. For d=2, it has a global minimum f(x)=-1.8013 at x=[2.2051, 1.5698]. For d=5, it has a global minimum f(x)=-4.6876. For d=10, it has a global minimum f(x)=-9.6602.
- odatse.solver.analytical.qing(xs: ndarray) float[source]#
Qing function.
- Parameters:
xs (np.ndarray) – Input array.
- Returns:
The calculated value of the Qing function.
- Return type:
float
Notes
It has a global minimum f(x)=0 at x=[+/-sqrt(n), …], where n runs from 1 to d.
- odatse.solver.analytical.quadratics(xs: ndarray) float[source]#
Quadratic (sphere) function.
- Parameters:
xs (np.ndarray) – Input array.
- Returns:
The calculated value of the quadratic function.
- Return type:
float
Notes
It has one global minimum f(xs)=0 at xs = [0,0,…,0].
- odatse.solver.analytical.quartics(xs: ndarray) float[source]#
Quartic function with two global minima.
- Parameters:
xs (np.ndarray) – Input array.
- Returns:
The calculated value of the quartic function.
- Return type:
float
Notes
It has two global minima f(xs)=0 at xs = [1,1,…,1] and [-1,-1,…,-1]. It has one saddle point f(0,0,…,0) = 1.0.
- odatse.solver.analytical.rastrigin(xs: ndarray) float[source]#
Rastrigin function.
- Parameters:
xs (np.ndarray) – Input array.
- Returns:
The calculated value of the Rastrigin function.
- Return type:
float
Notes
It has a global minimum f(x)=0 at x=[0,0,…,0].
- odatse.solver.analytical.rosenbrock(xs: ndarray) float[source]#
Rosenbrock’s function.
- Parameters:
xs (np.ndarray) – Input array.
- Returns:
The calculated value of Rosenbrock’s function.
- Return type:
float
Notes
It has one global minimum f(xs) = 0 at xs=[1,1,…,1].