summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-27 11:07:03 +0200
committerNao Pross <np@0hm.ch>2024-05-27 11:07:03 +0200
commit6a22d50ef71096a73476b59262c9ef23e4dcd8fe (patch)
treec419941cb9e7dc0271fe436fd1fc13520c887398
parentMake Canonicalization a sublass of Problem (diff)
downloadsumofsquares-6a22d50ef71096a73476b59262c9ef23e4dcd8fe.tar.gz
sumofsquares-6a22d50ef71096a73476b59262c9ef23e4dcd8fe.zip
Create aliases maximize and minimize for make_problem
-rw-r--r--sumofsquares/__init__.py10
1 files changed, 10 insertions, 0 deletions
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] = (),