Result removeConstraint(Constraint constraint)

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.

Source

Result removeConstraint(Constraint constraint) {
  _Tag tag = _constraints[constraint];
  if (tag == null)
    return Result.unknownConstraint;

  tag = new _Tag.fromTag(tag);
  _constraints.remove(constraint);

  _removeConstraintEffects(constraint, tag);

  _Row row = _rows[tag.marker];
  if (row != null) {
    _rows.remove(tag.marker);
  } else {
    _Symbol leaving = _leavingSymbolForMarkerSymbol(tag.marker);
    assert(leaving != null);

    row = _rows.remove(leaving);
    assert(row != null);
    row.solveForSymbols(leaving, tag.marker);
    _substitute(tag.marker, row);
  }

  return _optimizeObjectiveRow(_objective);
}