Skip to content

Commit

Permalink
fix: solve issue with diag operations
Browse files Browse the repository at this point in the history
  • Loading branch information
jagalindo committed Jul 23, 2024
1 parent 4cb63a1 commit fdf3765
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ def _prepare_assumptions_for_configuration(self, assumption: List[int],

if value:
desc = f'{feat.name} = true'
clause = [self.variables[feat[0].name], -1 * id_assumption]
clause = [self.variables[feat.name], -1 * id_assumption]
else:
desc = f'{feat.name} = false'
clause = [-1 * self.variables[feat[0].name], -1 * id_assumption]
clause = [-1 * self.variables[feat.name], -1 * id_assumption]

assumption.append(id_assumption)
self.set_kb.append(clause)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,25 @@ def add_root(self, feature: Feature) -> None:
self.destination_model.add_clause([var])
self.destination_model.add_clause_to_map(str(feature), [[var]])

def _store_constraint_relation(self, relation: Relation, clauses: List[List[int]]) -> None:
for clause in clauses:
self.destination_model.add_clause(clause)
self.destination_model.add_clause_to_map(str(relation), clauses)
#def _store_constraint_relation(self, relation: Relation, clauses: List[List[int]]) -> None:
# for clause in clauses:
# self.destination_model.add_clause(clause)
# self.destination_model.add_clause_to_map(str(relation), clauses)

def add_relation(self, relation: Relation) -> None:
if relation.is_mandatory():
clauses = self._add_mandatory_relation(relation)
elif relation.is_optional():
clauses = self._add_optional_relation(relation)
elif relation.is_or():
clauses = self._add_or_relation(relation)
elif relation.is_alternative():
clauses = self._add_alternative_relation(relation)
else:
clauses = self._add_constraint_relation(relation)
self._store_constraint_clauses(clauses)
self.destination_model.add_clause_to_map(str(relation), clauses)

def add_constraint(self, ctc: Constraint) -> None:
def get_term_variable(term: Any) -> int:
negated = False
Expand Down

0 comments on commit fdf3765

Please sign in to comment.