示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CmaEs{TSearchPoint}"/> class.
 /// </summary>
 /// <param name="searchPointSorter">
 /// Object responsible for sorting <typeparamref name="TSearchPoint"/>s.
 /// </param>
 /// <param name="searchPointFactory">
 /// Responsible for creating <typeparamref name="TSearchPoint"/>s from <see cref="Vector{T}"/> objects.
 /// </param>
 public CmaEs(
     ISearchPointSorter <TSearchPoint> searchPointSorter,
     Func <Vector <double>, TSearchPoint> searchPointFactory)
 {
     this._searchPointSorter  = searchPointSorter ?? throw new ArgumentNullException(nameof(searchPointSorter));
     this._searchPointFactory =
         searchPointFactory ?? throw new ArgumentNullException(nameof(searchPointFactory));
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DifferentialEvolution{TSearchPoint}"/> class.
        /// </summary>
        /// <param name="searchPointSorter">
        /// Specifies how to sort the <typeparamref name="TSearchPoint"/>s.
        /// </param>
        /// <param name="searchPointFactory">
        /// Specifies how to create a <typeparamref name="TSearchPoint"/> from a <see cref="Vector{T}"/> and a parent.
        /// </param>
        /// <param name="configuration">The <see cref="DifferentialEvolutionConfiguration"/> to use.</param>
        public DifferentialEvolution(
            ISearchPointSorter <TSearchPoint> searchPointSorter,
            Func <Vector <double>, TSearchPoint, TSearchPoint> searchPointFactory,
            DifferentialEvolutionConfiguration configuration)
        {
            this._searchPointSorter  = searchPointSorter ?? throw new ArgumentNullException(nameof(searchPointSorter));
            this._searchPointFactory =
                searchPointFactory ?? throw new ArgumentNullException(nameof(searchPointFactory));

            this._configuration     = configuration ?? throw new ArgumentNullException(nameof(configuration));
            this.MeanMutationFactor = this._configuration.InitialMeanMutationFactor;
            this.MeanCrossoverRate  = this._configuration.InitialMeanCrossoverRate;
        }