Exemplo n.º 1
0
 /// <summary>
 /// Gets the heuristic value for the given relative state (in the context of backward search).
 /// </summary>
 /// <param name="relativeState">Relative state to be evaluated.</param>
 /// <returns>Heuristic value for the specified relative state.</returns>
 protected override double GetValueImpl(IRelativeState relativeState)
 {
     if (Random.NextDouble() < Heuristics.First().Item2)
     {
         return(Heuristics.First().Item1.GetValue(relativeState));
     }
     return(Heuristics.Sum(heuristic => heuristic.Item2 * heuristic.Item1.GetValue(relativeState)));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Gets the heuristic value for the given conditions (in the context of backward search).
 /// </summary>
 /// <param name="conditions">Conditions to be evaluated.</param>
 /// <returns>Heuristic value for the specified conditions.</returns>
 protected override double GetValueImpl(IConditions conditions)
 {
     if (Random.NextDouble() < Heuristics.First().Item2)
     {
         return(Heuristics.First().Item1.GetValue(conditions));
     }
     return(Heuristics.Sum(heuristic => heuristic.Item2 * heuristic.Item1.GetValue(conditions)));
 }