Skip to content

Comparison of AST for constraints #76

@jmhorcas

Description

@jmhorcas

Actually, the comparison of AST needs revision. This is important to identify redundancies (e.g., duplicate constraints with different ASTs), as well as to use 'hash' function over the AST.

A first try: to compare two AST, and therefore two constraints, first we need to pass the AST to CNF (already done), remove duplicate clauses, and sort the clauses by lenght and then by variables strings:

clauses = ast.get_clauses()
sorted_clauses = list(map(sorted, clauses))
sorted_clauses.sort(key=len)

Maybe there is another more correct way.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions