}
void optimize(List<Operation> ops) {
Set<Operation> subsumed = new HashSet<Operation>();
for (int i = 0; i < ops.size(); i++) {
Operation op = ops.get(i);
for (int j = 0; j < i; j++) {
Operation c = ops.get(j);
if (!subsumed.contains(c) && op.subsumes(c))
subsumed.add(c);
}
}
int sc = 0;
for (Iterator<Operation> it = ops.iterator(); it.hasNext();) {
Operation op = it.next();
if (subsumed.contains(op)) {
it.remove();
sc++;
}
}