/// <summary> /// Constructs a problem with the given variables, constraints, /// and initial assignment. /// </summary> /// /// <param name="variables">the variables</param> /// /// <param name="constraints">the constraints</param> /// /// <param name="initialAssignment">the initial assignment</param> /// /// <exception cref="System.ArgumentNullException">if the variables or constraints are null</exception> public Problem(IEnumerable <Variable <TVar, TVal> > variables, IEnumerable <IConstraint <TVar, TVal> > constraints, Assignment <TVar, TVal> initialAssignment) : this( variables : ImmutableCollectionUtils.AsImmutableList(variables, throwExceptionIfNull : true), constraints : ImmutableCollectionUtils.AsImmutableList(constraints, throwExceptionIfNull : true), initialAssignment : initialAssignment ) { }
/// <summary> /// Constructs an assignment with the specified variable/value assignments. /// </summary> /// <param name="assignments">the assignments</param> public Assignment(IEnumerable <KeyValuePair <Variable <TVar, TVal>, TVal> > assignments) : this(ImmutableCollectionUtils.AsImmutableDictionary(assignments)) { }
public CostFunction(IEnumerable <ISoftConstraint <TVar, TVal> > softConstraints) : this(ImmutableCollectionUtils.AsImmutableList(softConstraints)) { }
public CostFunction(params ISoftConstraint <TVar, TVal>[] softConstraints) : this(ImmutableCollectionUtils.AsImmutableList(softConstraints)) { }
/// <summary> /// Constructs a constraint for ensuring that all of the specified variable have different values. /// </summary> /// <param name="variables">the variables</param> /// <exception cref="ArgumentException">if fewer than two variables are provided</exception> public AllDifferentConstraint(IEnumerable <Variable <TVar, TVal> > variables) : this(ImmutableCollectionUtils.AsImmutableList(variables)) { }
/// <summary> /// Constructs a constraint for ensuring that all of the specified variable have different values. /// </summary> /// <param name="variables">the variables</param> /// <exception cref="ArgumentException">if fewer than two variables are provided</exception> public AllDifferentConstraint(params Variable <TVar, TVal>[] variables) : this(ImmutableCollectionUtils.AsImmutableList(variables)) { }
/// <summary> /// Constructs a variable with the given user object and the given discrete domain. /// </summary> /// <param name="userObject">the object that this variable represents</param> /// <param name="domain">the domain of valid values that can be assigned to this variable</param> /// <exception cref="ArgumentNullException">if either the user object or domain is null</exception> public Variable(TVar userObject, IEnumerable <TVal> domain) : this(userObject, ImmutableCollectionUtils.AsImmutableList(domain, throwExceptionIfNull : true)) { }