コード例 #1
0
ファイル: FDVariable.cs プロジェクト: ianhorswill/CatSAT
 /// <summary>
 /// Make a new finite-domain variable to solve for
 /// </summary>
 /// <param name="name">"Name" to give to the variable (need not be a string)</param>
 /// <param name="domain">Domain of the variable</param>
 /// <param name="condition">Condition under which the variable is defined (null = true)</param>
 /// <param name="problem">Problem in which to define the variable</param>
 public FDVariable(object name, FDomain <T> domain, Literal condition, Problem problem)
     : base(name, problem, condition)
 {
     this.domain       = domain;
     ValuePropositions = domain.Elements.Select(v => problem.GetInternalProposition(new ValueProposition(this, v))).ToArray();
     if ((object)condition == null)
     {
         problem.Unique((IEnumerable <Literal>)ValuePropositions);
     }
     else
     {
         problem.Unique(ValuePropositions.Concat(new[] { Language.Not(condition) }));
     }
 }
コード例 #2
0
ファイル: FDVariable.cs プロジェクト: ianhorswill/CatSAT
 /// <summary>
 /// Make a new finite-domain variable to solve for
 /// </summary>
 /// <param name="name">"Name" to give to the variable (need not be a string)</param>
 /// <param name="domain">Domain of the variable</param>
 /// <param name="condition">Condition under which the variable is defined (null = true)</param>
 public FDVariable(object name, FDomain <T> domain, Literal condition = null) :
     this(name, domain, condition, Problem.Current)
 {
 }