removeConstraint method
Attempt to remove an individual Constraint from the solver.
Check the Result returned to make sure the operation succeeded. Any
errors will be reported via the message
property on the Result.
Possible Results:
- Result.success: The Constraint was successfully removed from the solver.
- Result.unknownConstraint: The Constraint was not in the solver so there was nothing to remove.
Implementation
Result removeConstraint(Constraint constraint) {
var tag = _constraints[constraint];
if (tag == null) {
return Result.unknownConstraint;
}
tag = _Tag.fromTag(tag);
_constraints.remove(constraint);
_removeConstraintEffects(constraint, tag);
var row = _rows[tag.marker];
if (row != null) {
_rows.remove(tag.marker);
} else {
final leaving = _leavingSymbolForMarkerSymbol(tag.marker);
row = _rows.remove(leaving);
row!.solveForSymbols(leaving, tag.marker);
_substitute(tag.marker, row);
}
return _optimizeObjectiveRow(_objective);
}