public void DoIteration(List <GridValueInterpolator> muGrids) { for (var centerIndex = 0; centerIndex < _settings.CentersSettings.CentersCount; centerIndex++) { if (_settings.CentersSettings.CenterDatas[centerIndex].IsFixed) { continue; } var rAlgorithm = _rAlgorithmSolvers[centerIndex]; _previousTaus[centerIndex] = rAlgorithm.CurrentX; var centerIndex2 = centerIndex; rAlgorithm.FunctionGradient = vector => { var gradientCalculator = new GradientCalculator(_settings); var gradientVector = gradientCalculator.CalculateGradientForCenter(rAlgorithm.CurrentX, muGrids[centerIndex2]); return(gradientVector); }; rAlgorithm.h = _settings.RAlgorithmSettings.H0 / (PerformedIterationCount + 1);// 0.5;//TODO adaptive step rAlgorithm.DoIteration(); } PerformedIterationCount++; }
public FuzzyPartitionPlacingCentersAlgorithm(PartitionSettings partitionSettings, List <Vector <double> > zeroCenters, List <GridValueInterpolator> zeroMuGrids) { PerformedIterationCount = 0; _settings = partitionSettings; _rAlgorithmSolvers = new List <RAlgorithmSolverBForm>(); _previousTaus.AddRange(Enumerable.Repeat(default(Vector <double>), _settings.CentersSettings.CentersCount)); for (var centerIndex = 0; centerIndex < _settings.CentersSettings.CentersCount; centerIndex++) { var zeroCenter = zeroCenters[centerIndex]; var gradientCalculator = new GradientCalculator(_settings); var gradientVector = gradientCalculator.CalculateGradientForCenter(zeroCenter, zeroMuGrids[centerIndex]); var rAlgorithm = new RAlgorithmSolverBForm(zeroCenter, _ => gradientVector, _settings.RAlgorithmSettings.SpaceStretchFactor); _rAlgorithmSolvers.Add(rAlgorithm); } }