From 06b717ae03432e48511961df416af37153a7bb07 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sun, 5 Nov 2023 14:03:14 +0100 Subject: Pass TestFinitePosetConstructionProduct --- src/act4e_solutions/posets_product.py | 1 - src/act4e_solutions/posets_representation.py | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/act4e_solutions/posets_product.py b/src/act4e_solutions/posets_product.py index 214a13a..3dc1bde 100644 --- a/src/act4e_solutions/posets_product.py +++ b/src/act4e_solutions/posets_product.py @@ -28,7 +28,6 @@ class MyFinitePosetProduct(I.FinitePosetProduct[C, E]): def holds(self, a: E, b: E) -> bool: a = self._carrier.unpack(a) b = self._carrier.unpack(b) - print(list(map(lambda p: p.carrier().elements(), self._posets)), a, b) # For all elements in both tuples, each element must be comparable with # the element with the same index in the other tuple. If one is not diff --git a/src/act4e_solutions/posets_representation.py b/src/act4e_solutions/posets_representation.py index 9adc22e..99fafdb 100644 --- a/src/act4e_solutions/posets_representation.py +++ b/src/act4e_solutions/posets_representation.py @@ -6,6 +6,7 @@ from pprint import pprint import numpy as np from .sets_representation import SolFiniteSetRepresentation +from .posets_product import MyFinitePosetProduct import act4e_interfaces as I @@ -118,7 +119,11 @@ class MyFinitePoset(I.FinitePoset[X]): class SolFinitePosetRepresentation(I.FinitePosetRepresentation): def load(self, h: I.IOHelper, s: I.FinitePoset_desc) -> I.FinitePoset[Any]: if "poset_product" in s.keys(): - raise NotImplementedError + posets = [] + for p in s["poset_product"]: + posets.append(self.load(h, p)) + + return MyFinitePosetProduct(posets) if "poset_sum" in s.keys(): raise NotImplementedError -- cgit v1.2.1