private void runAlgorithm(int amountOfAntibodies, int a, int b) { while (antibodies.Count() <= amountOfAntibodies) { System.Threading.Thread.Sleep(30); Cell tempCell = new Cell(a,b); if (tempCell.getCellValueOfFunction() > stemCell.getCellValueOfFunction() - stemCell.getCellValueOfFunction() * tollerance && tempCell.getCellValueOfFunction() < stemCell.getCellValueOfFunction() + stemCell.getCellValueOfFunction() * tollerance) { antibodies.Add(tempCell); ammountOfEpochs++; } else { ammountOfEpochs++; } } }
private double tollerance; //tolerancja odchylenia wyrażona w liczbie od 0 do 1 (procenty) #endregion Fields #region Constructors public NegativeSelectionAlgorithmClass(int min, int max, int amountOfAntibodies, double tollerance) { try { if (tollerance > 0 && tollerance < 1) { this.tollerance = tollerance; } else { throw new Exception("Nie prawidłowa wartość tolerancji"); } } catch(Exception e) { System.Console.WriteLine(e.Message); } this.stemCell = new Cell(min, max); runAlgorithm(amountOfAntibodies, min, max); }