From fc87ba7ab62e2a5431e9512375d52ee7dfaa1283 Mon Sep 17 00:00:00 2001 From: Tim Mensinger Date: Wed, 23 Oct 2024 17:20:24 +0200 Subject: [PATCH] Add BenchmarkProblem base class --- .../benchmarking/benchmark_problem.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/optimagic/benchmarking/benchmark_problem.py diff --git a/src/optimagic/benchmarking/benchmark_problem.py b/src/optimagic/benchmarking/benchmark_problem.py new file mode 100644 index 000000000..bf322296e --- /dev/null +++ b/src/optimagic/benchmarking/benchmark_problem.py @@ -0,0 +1,30 @@ +from abc import ABC, abstractmethod + +import numpy as np +from numpy.typing import NDArray + + +class BenchmarkProblem(ABC): + @abstractmethod + def fun(self, x: NDArray[np.float64]) -> float | NDArray[np.float64]: + pass + + @property + @abstractmethod + def start_x(self) -> NDArray[np.float64]: + pass + + @property + @abstractmethod + def solution_x(self) -> NDArray[np.float64] | None: + pass + + @property + @abstractmethod + def start_fun(self) -> float: + pass + + @property + @abstractmethod + def solution_fun(self) -> float: + pass