public override TSAFuzzySystem TuneUpFuzzySystem(TSAFuzzySystem Approx, ILearnAlgorithmConf conf) { TSAFuzzySystem result = Approx; BeeParamsConf Config = conf as BeeParamsConf; Init(Config); theFuzzySystem = result; if (result.RulesDatabaseSet.Count < 1) { throw (new Exception("Что то не так с базой правил")); } theHive = new HiveParams(this, result.RulesDatabaseSet[0]); // HiveParams theHive = new ParallelHiveParams(this, result.RulesDatabaseSet[0]); // HiveParams theHive = new HiveParallelParams2(this, result.RulesDatabaseSet[0]); theBest = new BeeParams(result.RulesDatabaseSet[0], this); double temperature = initTemp; for (int r = 0; r < iterration; r++) { temperature = oneIterate(temperature); GC.Collect(); } theBest = lastStep(theBest); Approx.RulesDatabaseSet[0] = theBest.PositionOfBee; Approx.RulesDatabaseSet[0].TermsSet.Trim(); return(Approx); }
public static List <BeeParams> OutLookerFly(BeeParams Best, List <BeeParams> Source, Random rand, BeeParamsAlgorithm parrent) { List <BeeParams> Result = new List <BeeParams>(); for (int i = 0; i < Source.Count(); i++) { Result.Add(new OutLookersBeeParams(Source[i].PositionOfBee, Best.PositionOfBee, parrent, rand)); } return(Result); }
public double oneIterate(double temperature) { theHive.flyScouts(countScouts, rand, theBest.PositionOfBee); double newtemperature = theHive.LimitScoutBeeSolution(temperature, coefTemp, rand); theBest = theHive.findBestinHive(); theHive.flyWorkers(theBest, rand); theHive.flyOutLookers(theBest, rand); countScouts = theHive.makeNewPopulation(TypeSelection, hiveSize, persentScouts, rand, border1, border2, border3, repeat1, repeat2, repeat3); theBest = theHive.findBestinHive(); return(newtemperature); }
protected BeeParams lastStep(BeeParams theBest) { double tempgood = theBest.getGoodsImproove(); KnowlegeBaseTSARules tempPositionofBee = theBest.PositionOfBee; TSAFuzzySystem ToOpintNS = getCurrentNs(); KnowlegeBaseTSARules zeroSolution = ToOpintNS.RulesDatabaseSet[0]; ToOpintNS.RulesDatabaseSet[0] = theBest.PositionOfBee; RWLSMTakagiSugeno tryOpt = new RWLSMTakagiSugeno(); tryOpt.TuneUpFuzzySystem(ToOpintNS, new NullConfForAll()); theBest.PositionOfBee = ToOpintNS.RulesDatabaseSet[0]; double newgood = theBest.getGoodsImproove(); if (newgood > tempgood) { theBest.PositionOfBee = tempPositionofBee; } return(theBest); }
public virtual void flyOutLookers(BeeParams best, Random rand) { theOutlookers = OutLookersBeeParams.OutLookerFly(best, hostArchive, rand, theParrent); }
public virtual void flyWorkers(BeeParams best, Random rand) { theWorkers = WorkerParams.WorkersFly(best, hostArchive, rand, theParrent); }