コード例 #1
0
        /// <summary>
        ///     Calculates the distance between two behaviors.
        /// </summary>
        /// <param name="behavior1">The first behavior in the distance calculation.</param>
        /// <param name="behavior2">The second behavior in the distance calculation.</param>
        /// <returns>A measure of the behavioral distance.</returns>
        public static double CalculateDistance(BehaviorInfo behavior1, BehaviorInfo behavior2)
        {
            if (behavior1.Behaviors.Length != behavior2.Behaviors.Length)
            {
                throw new SharpNeatException(
                          "Cannot compare behavior characterizations because behavior length differs.");
            }

            // Calculate the difference between the behavior double-precision arrays
            return(CalculateDistance(behavior1.Behaviors, behavior2.Behaviors));
        }
コード例 #2
0
        /// <summary>
        ///     Evalutes whether the given (preumably euclidean) behavior characterization satisfies the minimal criteria.
        /// </summary>
        /// <param name="behaviorInfo">The behavior info in euclidean space.</param>
        /// <returns>Boolean value indicating whether the given behavior characterization satisfies the minimal criteria.</returns>
        public bool DoesCharacterizationSatisfyMinimalCriteria(BehaviorInfo behaviorInfo)
        {
            // If the behavior dimensionality doesn't match, we can't compare it
            if (behaviorInfo.Behaviors.Length != EuclideanDimensions)
            {
                throw new SharpNeatException(
                    "Cannot evaluate minimal criteria constraints because the behavior characterization is not of the correct dimensionality.");
            }

            // Extract x and y components of location
            var xLocation = behaviorInfo.Behaviors[0];
            var yLocation = behaviorInfo.Behaviors[1];

            // Return false if the location falls outside of the bounds of the min/max x and y locations
            return !(xLocation < _xMin) && !(xLocation > _xMax) && !(yLocation < _yMin) && !(yLocation > _yMax);
        }
 /// <summary>
 ///     Evaluates whether the given behavior info meets the minimal criteria for this behavior characterization.
 /// </summary>
 /// <param name="behaviorInfo">The behavior info to evaluate.</param>
 /// <returns>
 ///     Boolean value indicating whether the given behavior info meets the minimal criteria for this behavior
 ///     characterization.
 /// </returns>
 public bool IsMinimalCriteriaSatisfied(BehaviorInfo behaviorInfo)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
 /// <summary>
 ///     Evaluates whether the given behavior info meets the minimal criteria for this behavior characterization.
 /// </summary>
 /// <param name="behaviorInfo">The behavior info to evaluate.</param>
 /// <returns>
 ///     Boolean value indicating whether the given behavior info meets the minimal criteria for this behavior
 ///     characterization.
 /// </returns>
 public bool IsMinimalCriteriaSatisfied(BehaviorInfo behaviorInfo)
 {
     // If there is no minimal criteria, then by definition it has been met
     return _minimalCriteria?.DoesCharacterizationSatisfyMinimalCriteria(behaviorInfo) ??
            true;
 }
コード例 #5
0
 /// <summary>
 ///     Evaluates whether the given behavior info meets the minimal criteria for this behavior characterization.  However,
 ///     given that this is the null behavior characterization, it will always meet the minimal criteria (given that there
 ///     probably isn't one).
 /// </summary>
 /// <param name="behaviorInfo">The behavior info to evaluate.</param>
 /// <returns>
 ///     Boolean value indicating whether the given behavior info meets the minimal criteria for this behavior
 ///     characterization.  This will always be true given that this is the null behavior characterization.
 /// </returns>
 public bool IsMinimalCriteriaSatisfied(BehaviorInfo behaviorInfo)
 {
     return true;
 }