From 4d9a391cbee170e45c4805e94610819f9d8a43e9 Mon Sep 17 00:00:00 2001 From: Tobias Stolzmann Date: Thu, 22 Feb 2024 10:40:43 +0100 Subject: [PATCH] Add an assertion that checks if a model is optimal --- clintest/assertion.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/clintest/assertion.py b/clintest/assertion.py index 2aa6b12..f915307 100644 --- a/clintest/assertion.py +++ b/clintest/assertion.py @@ -125,6 +125,18 @@ def holds_for(self, model: Model) -> bool: return set(model.symbols(shown=True)).issuperset(self.__symbols) +class Optimal(Assertion): + """ + An assertion that holds if the optimality of a model is proven. + """ + + def __repr__(self): + return f"{self.__class__.__name__}()" + + def holds_for(self, model: Model) -> bool: + return model.optimality_proven + + class True_(Assertion): """ The assertion that is true for each model.