예제 #1
0
        public ThroughputOptimizer(long minimumBatchSize, long maximumBatchSize, int adjustmentPercentage = 25, int stabilityTolerancePercentage = 10, SamplingAdjustmentDirection initialAdjustmentDirection = SamplingAdjustmentDirection.Increasing)
        {
            if (adjustmentPercentage < 0 || adjustmentPercentage > 100)
            {
                throw new ArgumentOutOfRangeException("adjustmentPercentage", adjustmentPercentage, "Needs to be between 0 and 100");
            }
            if (stabilityTolerancePercentage < 0 || stabilityTolerancePercentage > 100)
            {
                throw new ArgumentOutOfRangeException("stabilityTolerancePercentage", stabilityTolerancePercentage, "Needs to be between 0 and 100");
            }
            if (stabilityTolerancePercentage < 0 || stabilityTolerancePercentage > 100)
            {
                throw new ArgumentOutOfRangeException("stabilityTolerancePercentage", stabilityTolerancePercentage, "Needs to be between 0 and 100");
            }
            if (initialAdjustmentDirection == SamplingAdjustmentDirection.Stablized)
            {
                throw new ArgumentException("Must be Increasing or Decreasing", "initialAdjustmentDirection");
            }
            if (minimumBatchSize < 0)
            {
                throw new ArgumentOutOfRangeException("minimumBatchSize", minimumBatchSize, "Must be greater than 0");
            }
            if (maximumBatchSize < minimumBatchSize)
            {
                throw new ArgumentException("maximumBatchSize must be greater than minimumBatchSize");
            }

            _minimumBatchSize           = minimumBatchSize;
            _maximumBatchSize           = maximumBatchSize;
            _adjustmentFactor           = adjustmentPercentage / 100.0;
            _toleranceFactor            = stabilityTolerancePercentage / 100.0;
            _initialAdjustmentDirection = initialAdjustmentDirection;
            AdjustmentDirection         = initialAdjustmentDirection;
            SampleCount           = 0;
            _optimalBatchSize     = 0;
            _optimalBatchVelocity = 0;
        }
예제 #2
0
 public ThroughputOptimizer(long minimumBatchSize, long maximumBatchSize, double adjustmentPercentage, double stabilityTolerancePercentage, SamplingAdjustmentDirection initialAdjustmentDirection = SamplingAdjustmentDirection.Increasing)
     : this(minimumBatchSize, maximumBatchSize, (int)Math.Round(adjustmentPercentage * 100.0, 0), (int)Math.Round(stabilityTolerancePercentage * 100.0, 0), initialAdjustmentDirection)
 {
 }