예제 #1
0
 def apply_to_backend_request(self,
                              block: Block,
                              level: Tuple[Factor, Union[SimpleLevel, DerivedLevel]],
                              backend_request: BackendRequest
                              ) -> None:
     sublists = block.build_variable_list(level)
     backend_request.ll_requests.append(LowLevelRequest("EQ", self.k, sublists))
예제 #2
0
 def apply(self, block: Block, backend_request: BackendRequest) -> None:
     var_list = block.build_variable_list((self.factor, self.level))
     backend_request.cnfs.append(And(list(map(lambda n: n * -1, var_list))))
예제 #3
0
 def _build_variable_sublists(self, block: Block, level: Tuple[Factor, Union[SimpleLevel, DerivedLevel]], sublist_length: int) -> List[List[int]]:
     var_list = block.build_variable_list(level)
     raw_sublists = [var_list[i:i+sublist_length] for i in range(0, len(var_list))]
     return list(filter(lambda l: len(l) == sublist_length, raw_sublists))