public void LogTabuTtp1Intro(TabuParameters parameters) { using (var file = new System.IO.StreamWriter(OutputPath, true)) { file.WriteLine("TABU LIST SIZE:" + parameters.TabuSize); file.WriteLine("NEIGHBOURHOOD SIZE:" + parameters.NeighbourhoodSize); if (LogOutputType == AlgorithmLogOutput) { file.WriteLine("NUM_SEARCH;BEST_FITNESS; CURRENT_FITNESS;"); } } }
public GeneticPeriodicTabu(Problem.Problem problem, GeneticPeriodicTabuParameters parameters) { Problem = problem; Genetic = new GaTtp1(problem, parameters.GeneticParameters); var tabuParameters = new TabuParameters { NeighbourhoodSize = parameters.TabuParameters.NeighbourhoodSize, NumAlgorithmIterations = 1, NumTabuSearches = parameters.TabuParameters.NumTabuSearches, TabuSize = parameters.TabuParameters.TabuSize, }; Parameters = parameters; Parameters.TabuParameters = tabuParameters; Tabu = new TabuTtp1(problem, tabuParameters); }
public void NelderOtherHeuristics() { int thinningPeriod = 4; int treeCount = 75; #if DEBUG treeCount = 25; #endif PlotsWithHeight nelder = PublicApi.GetNelder(); OrganonConfiguration configuration = OrganonTest.CreateOrganonConfiguration(new OrganonVariantNwo()); configuration.Treatments.Harvests.Add(new ThinByIndividualTreeSelection(thinningPeriod)); OrganonStand stand = nelder.ToOrganonStand(configuration, 20, 130.0F, treeCount); stand.PlantingDensityInTreesPerHectare = TestConstant.NelderReplantingDensityInTreesPerHectare; Objective landExpectationValue = new Objective() { IsLandExpectationValue = true, PlanningPeriods = 9 }; Objective volume = new Objective() { PlanningPeriods = landExpectationValue.PlanningPeriods }; HeuristicParameters defaultParameters = new HeuristicParameters() { UseScaledVolume = false }; GeneticParameters geneticParameters = new GeneticParameters(treeCount) { PopulationSize = 7, MaximumGenerations = 5, UseScaledVolume = defaultParameters.UseScaledVolume }; GeneticAlgorithm genetic = new GeneticAlgorithm(stand, configuration, landExpectationValue, geneticParameters); TimeSpan geneticRuntime = genetic.Run(); GreatDeluge deluge = new GreatDeluge(stand, configuration, volume, defaultParameters) { RainRate = 5, LowerWaterAfter = 9, StopAfter = 10 }; deluge.RandomizeTreeSelection(TestConstant.Default.SelectionPercentage); TimeSpan delugeRuntime = deluge.Run(); RecordTravel recordTravel = new RecordTravel(stand, configuration, landExpectationValue, defaultParameters) { StopAfter = 10 }; recordTravel.RandomizeTreeSelection(TestConstant.Default.SelectionPercentage); TimeSpan recordRuntime = recordTravel.Run(); SimulatedAnnealing annealer = new SimulatedAnnealing(stand, configuration, volume, defaultParameters) { Iterations = 100 }; annealer.RandomizeTreeSelection(TestConstant.Default.SelectionPercentage); TimeSpan annealerRuntime = annealer.Run(); TabuParameters tabuParameters = new TabuParameters() { UseScaledVolume = defaultParameters.UseScaledVolume }; TabuSearch tabu = new TabuSearch(stand, configuration, landExpectationValue, tabuParameters) { Iterations = 7, //Jump = 2, MaximumTenure = 5 }; tabu.RandomizeTreeSelection(TestConstant.Default.SelectionPercentage); TimeSpan tabuRuntime = tabu.Run(); ThresholdAccepting thresholdAcceptor = new ThresholdAccepting(stand, configuration, volume, defaultParameters); thresholdAcceptor.IterationsPerThreshold.Clear(); thresholdAcceptor.Thresholds.Clear(); thresholdAcceptor.IterationsPerThreshold.Add(10); thresholdAcceptor.Thresholds.Add(1.0F); thresholdAcceptor.RandomizeTreeSelection(TestConstant.Default.SelectionPercentage); TimeSpan acceptorRuntime = thresholdAcceptor.Run(); RandomGuessing random = new RandomGuessing(stand, configuration, volume, defaultParameters) { Iterations = 4 }; TimeSpan randomRuntime = random.Run(); configuration.Treatments.Harvests.Clear(); configuration.Treatments.Harvests.Add(new ThinByPrescription(thinningPeriod)); PrescriptionParameters prescriptionParameters = new PrescriptionParameters() { Maximum = 60.0F, Minimum = 50.0F, Step = 10.0F, UseScaledVolume = defaultParameters.UseScaledVolume }; PrescriptionEnumeration enumerator = new PrescriptionEnumeration(stand, configuration, landExpectationValue, prescriptionParameters); TimeSpan enumerationRuntime = enumerator.Run(); // heuristics assigned to volume optimization this.Verify(deluge); this.Verify(annealer); this.Verify(thresholdAcceptor); this.Verify(random); // heuristics assigned to net present value optimization this.Verify(genetic); this.Verify(enumerator); this.Verify(recordTravel); this.Verify(tabu); HeuristicSolutionDistribution distribution = new HeuristicSolutionDistribution(1, thinningPeriod, treeCount); distribution.AddRun(annealer, annealerRuntime, defaultParameters); distribution.AddRun(deluge, delugeRuntime, defaultParameters); distribution.AddRun(thresholdAcceptor, acceptorRuntime, defaultParameters); distribution.AddRun(genetic, geneticRuntime, defaultParameters); distribution.AddRun(enumerator, enumerationRuntime, defaultParameters); distribution.AddRun(recordTravel, recordRuntime, defaultParameters); distribution.AddRun(tabu, tabuRuntime, defaultParameters); distribution.AddRun(random, randomRuntime, defaultParameters); distribution.OnRunsComplete(); }
public string resolveTabuSearchGAPInstance(TabuParameters paramts) { GAPInstance Gap = JSONConverter.deserializeGAP(dataDirectory + "\\" + paramts.getFileName()); return(new BasicHeu(Gap).tabuSearch(paramts.getQueueSize(), paramts.getMaxSteps()).ToString()); }