Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Constraint Independence. #1202

Open
feliam opened this issue Oct 21, 2018 · 0 comments
Open

Implement Constraint Independence. #1202

feliam opened this issue Oct 21, 2018 · 0 comments

Comments

@feliam
Copy link
Contributor

feliam commented Oct 21, 2018

Many constraints do not overlap in terms of the memory they reference. Constraint independence divides constraint sets into disjoint independent subsets based on the symbolic variables and memory cells they reference. By explicitly tracking these subsets, it can frequently eliminate irrelevant constraints prior to sending it to the solver. For example, given the constraint set {i < j, j < 20, k > 0}, a query of whether i = 20 just requires the first two constraints.

We need tests for the implemented bit related to this feature:

def __get_related(self, related_to=None):
if related_to is not None:
number_of_constraints = len(self.constraints)
remaining_constraints = set(self.constraints)
related_variables = get_variables(related_to)
related_constraints = set()
added = True
while added:
added = False
logger.debug('Related variables %r', [x.name for x in related_variables])
for constraint in list(remaining_constraints):
if isinstance(constraint, BoolConstant):
if constraint.value:
continue
else:
related_constraints = {constraint}
break
variables = get_variables(constraint)
if related_variables & variables:
remaining_constraints.remove(constraint)
related_constraints.add(constraint)
related_variables |= variables
added = True
logger.debug('Reduced %d constraints!!', number_of_constraints - len(related_constraints))
else:
related_variables = set()
for constraint in self.constraints:
related_variables |= get_variables(constraint)
related_constraints = set(self.constraints)
return related_variables, related_constraints

And research the possibility of doing the same thing for not overlapping array references.
If you have constraints over the first half of the memory that are never related to the constraints that work over the second half of the memory you could send only half the memory array to the solver at certain situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Manticore
  
Backlog
Development

No branches or pull requests

2 participants