public Constraint AddAllDifferent(IEnumerable<IntVar> vars) { Constraint ct = new Constraint(model_); AllDifferentConstraintProto alldiff = new AllDifferentConstraintProto(); foreach (IntVar var in vars) { alldiff.Vars.Add(var.Index); } ct.Proto.AllDiff = alldiff; return ct; }
public Constraint AddAllDifferent(IEnumerable <IntVar> vars) { Constraint ct = new Constraint(model_); AllDifferentConstraintProto alldiff = new AllDifferentConstraintProto(); foreach (IntVar var in vars) { alldiff.Exprs.Add(GetLinearExpressionProto(var)); } ct.Proto.AllDiff = alldiff; return(ct); }
/** * <summary> * Adds the constraint <c>AllDifferent(exprs)</c>. * </summary> */ public Constraint AddAllDifferent(IEnumerable <LinearExpr> exprs) { AllDifferentConstraintProto alldiff = new AllDifferentConstraintProto(); alldiff.Exprs.TrySetCapacity(exprs); foreach (LinearExpr expr in exprs) { alldiff.Exprs.Add(GetLinearExpressionProto(expr)); } Constraint ct = new Constraint(model_); ct.Proto.AllDiff = alldiff; return(ct); }