diff options
author | Nao Pross <np@0hm.ch> | 2024-05-08 12:10:23 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-05-08 12:10:23 +0200 |
commit | ac9af956910c587b033a4beb756ad2d21697e78c (patch) | |
tree | b7eda89d2687c9ad7a7441e73307f3bd09d15a4e | |
parent | Expose ArchimedeanSet with make_set (diff) | |
download | sumofsquares-ac9af956910c587b033a4beb756ad2d21697e78c.tar.gz sumofsquares-ac9af956910c587b033a4beb756ad2d21697e78c.zip |
Make CVXOPInfo behave like a dataclass
-rw-r--r-- | sumofsquares/cvxopt.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sumofsquares/cvxopt.py b/sumofsquares/cvxopt.py index ce7b093..12f8e44 100644 --- a/sumofsquares/cvxopt.py +++ b/sumofsquares/cvxopt.py @@ -18,6 +18,13 @@ from .variable import OptVariable class CVXOPTInfo(SolverInfo, UserDict): """ Dictionary returned by CVXOPT. """ + def __getattr__(self, attr): + key = " ".join(attr.split("_")) + if key not in self.keys(): + raise KeyError(f"Key {key} was not found") + return self[key] + + def solve_sos_cone(prob: Problem, verbose: bool = False, *args, **kwargs) -> tuple[dict[OptVariable, float], CVXOPTInfo]: r""" |