removeConstraint method

Result removeConstraint(
  1. 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:

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);
}