public override TSAFuzzySystem TuneUpFuzzySystem(TSAFuzzySystem Approximate, ILearnAlgorithmConf conf) { BacteryAlgorithmConfig Config = conf as BacteryAlgorithmConfig; sendBactery = Config.BFOCountSolution; interPSOtoSend = Config.BFOCountIteration; result = Approximate; if (result.RulesDatabaseSet.Count < 1) { throw new InvalidDataException("Нечеткая система не проинициализированна"); } KnowlegeBaseTSARules backSave = new KnowlegeBaseTSARules(result.RulesDatabaseSet[0]); double backResult = result.approxLearnSamples(result.RulesDatabaseSet[0]); savetoUFS(result.RulesDatabaseSet, 0, 0, 0); BacteryRunner(); KnowlegeBaseTSARules[] solutions = loadDatabase(); solutions = sortSolution(solutions); if (solutions.Count() < 1) { result.RulesDatabaseSet[0] = backSave; return(result); } result.RulesDatabaseSet[0] = solutions[0]; double newResult = result.approxLearnSamples(result.RulesDatabaseSet[0]); if (newResult > backResult) { result.RulesDatabaseSet[0] = backSave; } result.RulesDatabaseSet[0].TermsSet.Trim(); return(result); }
public override ILearnAlgorithmConf getConf(int CountFeatures) { ILearnAlgorithmConf result = new BacteryAlgorithmConfig(); result.Init(CountFeatures); return(result); }