Skip to content

Commit 438ba8d

Browse files
author
martin
committed
Avoid generating redundant constraints by iterating over n^2/2 rather 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.
1 parent 22a68fe commit 438ba8d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/solvers/flattening/arrays.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ void arrayst::add_array_Ackermann_constraints()
316316
i1!=index_set.end();
317317
i1++)
318318
for(index_sett::const_iterator
319-
i2=index_set.begin();
319+
i2=i1;
320320
i2!=index_set.end();
321321
i2++)
322322
if(i1!=i2)

0 commit comments

Comments
 (0)