Example #1
0
 RankingDictionary<int> GetCandidateRanking(List<SudokuCell> block)
 {
     FrequencyDictionary<int> candidateFrequency = new FrequencyDictionary<int>();
     foreach(SudokuCell cell in block)
     {
         candidateFrequency.AddRange(cell.Candidates.ToArray());
     }
     return candidateFrequency.GetRankingDictionary();
 }
 /// <summary>
 /// Returns the state of criterion. True, if everything is done, false - otherwise.
 /// </summary>
 /// <param name="chain">
 /// The chain.
 /// </param>
 /// <param name="alphabet">
 /// Chains alphabet.
 /// </param>
 /// <returns>
 /// The state of criterion.
 /// </returns>
 public abstract bool State(ComplexChain chain, FrequencyDictionary alphabet);
 /// <summary>
 /// Returns distortion between necessary and calculated value.
 /// For example between theoretical and practical values.
 /// </summary>
 /// <param name="chain">
 /// The chain.
 /// </param>
 /// <param name="alphabet">
 /// The alphabet.
 /// </param>
 /// <returns>
 /// The <see cref="double"/>.
 /// </returns>
 public abstract double Distortion(ComplexChain chain, FrequencyDictionary alphabet);
 /// <summary>
 ///  Updates data for computing a new value of the criterion.
 /// </summary>
 /// <param name="chain">
 /// A new chain.
 /// </param>
 /// <param name="alphabet">
 /// A new alphabet.
 /// </param>
 public void Renew(ComplexChain chain, FrequencyDictionary alphabet)
 {
     this.chain = chain;
     this.alphabet = alphabet;
 }