addEditVariables method

Result addEditVariables(
  1. List<Variable> variables,
  2. double priority
)

Adds a list of edit Variables to the Solver at a given priority. Either all edit Variable are added or none. No edit variables may be added at Priority.required.

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 edit variables were successfully added to Solver at the specified priority.
  • Result.duplicateEditVariable: One of more edit variables were already present in the Solver or the same edit variables were specified multiple times in the list. Remove the duplicates and try again.
  • Result.badRequiredStrength: The edit variables were added at Priority.required. Edit variables are used to suggest values to the solver. Since suggestions can't be mandatory, priorities cannot be Priority.required. If variable values need to be fixed at Priority.required, add that preference as a constraint. This allows the solver to check for satisfiability of the constraint (w.r.t other constraints at Priority.required) and check for duplicates.

Implementation

Result addEditVariables(List<Variable> variables, double priority) {
  Result applier(v) => addEditVariable(v, priority);
  Result undoer(v) => removeEditVariable(v);

  return _bulkEdit(variables, applier, undoer);
}