Skip to content

Commit

Permalink
Avoid generating redundant constraints by iterating over n^2/2 rather…
Browse files Browse the repository at this point in the history
… than n^2 pairs.

Ackermann constaints are symmetric so we don't need to consider every pair of indexes,
only every ordered pair.  This can halve the number of constraints generated which can
be a significant saving in terms of problem size but also saves significant time when
used in the string solver.
  • Loading branch information
martin authored and Matthias Güdemann committed Oct 12, 2017
1 parent d8b25f3 commit 40ff71b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/solvers/flattening/arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ void arrayst::add_array_Ackermann_constraints()
i1!=index_set.end();
i1++)
for(index_sett::const_iterator
i2=index_set.begin();
i2=i1;
i2!=index_set.end();
i2++)
if(i1!=i2)
Expand Down

0 comments on commit 40ff71b

Please sign in to comment.