Document visualization workflow for lab 5 report

This commit is contained in:
Artem
2025-11-12 15:06:53 +03:00
parent ca1095671e
commit f213bc3fb5
9 changed files with 1077 additions and 1 deletions

33
lab5/functions.py Normal file
View File

@@ -0,0 +1,33 @@
"""Benchmark functions used in lab 5."""
from __future__ import annotations
import numpy as np
from numpy.typing import NDArray
Array = NDArray[np.float64]
def axis_parallel_hyperellipsoid(x: Array) -> float:
"""Axis-parallel hyper-ellipsoid benchmark function.
Parameters
----------
x:
Point in :math:`\mathbb{R}^n`.
Returns
-------
float
The value of the hyper-ellipsoid function.
"""
indices = np.arange(1, x.shape[0] + 1, dtype=np.float64)
return float(np.sum(indices * np.square(x)))
def default_bounds(dimension: int, lower: float = -5.12, upper: float = 5.12) -> tuple[Array, Array]:
"""Construct symmetric bounds for each dimension."""
x_min = np.full(dimension, lower, dtype=np.float64)
x_max = np.full(dimension, upper, dtype=np.float64)
return x_min, x_max