[CS] Remove ConstraintGraph::removeEdge

The only caller was `contractEdges`, which would
only call it with constraints from either the
active or inactive list. The implementation can
therefore be replaced by
`ConstraintSystem::retireConstraint`, and
`removeGeneratedConstraint` can also be removed.
This commit is contained in:
Hamish Knight
2020-04-13 17:37:16 -07:00
parent 82cdf91512
commit 41083524dd
3 changed files with 2 additions and 53 deletions

View File

@@ -1165,8 +1165,8 @@ bool ConstraintGraph::contractEdges() {
log << "\n";
}
// Merge the edges and remove the constraint.
removeEdge(constraint);
// Merge the edges and retire the constraint.
CS.retireConstraint(constraint);
if (rep1 != rep2)
CS.mergeEquivalenceClasses(rep1, rep2, /*updateWorkList*/ false);
didContractEdges = true;
@@ -1175,35 +1175,6 @@ bool ConstraintGraph::contractEdges() {
return didContractEdges;
}
void ConstraintGraph::removeEdge(Constraint *constraint) {
bool isExistingConstraint = false;
for (auto &active : CS.ActiveConstraints) {
if (&active == constraint) {
CS.ActiveConstraints.erase(constraint);
isExistingConstraint = true;
break;
}
}
for (auto &inactive : CS.InactiveConstraints) {
if (&inactive == constraint) {
CS.InactiveConstraints.erase(constraint);
isExistingConstraint = true;
break;
}
}
if (CS.solverState) {
if (isExistingConstraint)
CS.solverState->retireConstraint(constraint);
else
CS.solverState->removeGeneratedConstraint(constraint);
}
removeConstraint(constraint);
}
void ConstraintGraph::optimize() {
// Merge equivalence classes until a fixed point is reached.
while (contractEdges()) {}