From 6a22d50ef71096a73476b59262c9ef23e4dcd8fe Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 27 May 2024 11:07:03 +0200 Subject: Create aliases maximize and minimize for make_problem --- sumofsquares/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sumofsquares/__init__.py b/sumofsquares/__init__.py index 2886326..5d9f432 100644 --- a/sumofsquares/__init__.py +++ b/sumofsquares/__init__.py @@ -107,6 +107,16 @@ def make_problem( return psatz(SOSProblem(cost, constraints, solver)) +def minimize(cost, *args, **kwargs) -> SOSProblem: + """ Alias for make_problem. """ + return make_problem(cost, *args, **kwargs) + + +def maximize(cost, *args, **kwargs) -> SOSProblem: + """ Alias for make_problem(-cost, constraints, ...). """ + return make_problem(-cost, *args, **kwargs) + + def solve_problem( cost: Expression, constraints: Iterable[Constraint] = (), -- cgit v1.2.1