Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Обработка случаев невозможности вычисления целевой функции
Browse files Browse the repository at this point in the history
  • Loading branch information
rkolovanov committed Dec 5, 2023
1 parent a08c1a8 commit b8c419a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion optimization_methods/common/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ def __call__(self, x: np.array) -> float:
args = {}
for i in range(0, len(x)):
args[f"x{i+1}"] = x[i]
return float(self.function.subs(args))
try:
return float(self.function.subs(args))
except Exception as error:
raise RuntimeError(f"Невозможно вычислить вещественное значение целевой функции в точке {x}. {error}.")

0 comments on commit b8c419a

Please sign in to comment.