public SubProblemBuilder Apply(string key, SubProblemBuilder subProblemBuilder) { return(subProblemBuilder .WithEncoding <Chromosome.Permutation>(key) .WithAlgorithm <Algorithm.SteadyState>() .SetParameter(Algorithm.ParameterNames.PopulationSize, Size * 3) //*2 .SetParameter(Chromosome.ParameterNames.MutationProbability, 0.7) .SetParameter(Algorithm.ParameterNames.FitnessLength, 1) .SetParameter(Population.ParameterNames.TournamentSize, 2) .SetParameter(Core.Island.ParameterNames.IslandsCount, 1) //.SetParameter(Core.Island.ParameterNames.IslandsCount, Math.Floor(Math.Sqrt(Size))) .SetParameter("ProblemSize", Size)); }
public void SubProblemBuilder_Serialize_ShouldReturnSame() { var subProblem = new SubProblemBuilder() .WithEncoding <Chromosome.Permutation>("TSP") .WithAlgorithm <SteadyState>() .Selections.Add <TournamentSelection>() .ReInsertions.Add <ReplaceWorstParentWithBestChildrenReinsertion>() .Operators.Clear() .Operators.Add <Chromosome.Implementation.Permutation.ShuffleRangeMutation>() .AddConflictDetector <AllRightConflictDetector>() .SetParameter("SomeParameter", 3.141592654) .Build(); var result = SerializeAndDeserialize <SubProblem>(subProblem); result.Should().BeEquivalentTo(subProblem); }
public SubProblemBuilder Apply(string key, SubProblemBuilder subProblemBuilder) { return(subProblemBuilder .WithEncoding <Chromosome.SortedSubset>(key) .WithAlgorithm <Algorithm.SteadyState>() .SetParameter(Algorithm.ParameterNames.PopulationSize, TripsCount / 10) .SetParameter(Chromosome.ParameterNames.MutationProbability, 0.7) .SetParameter(Population.ParameterNames.TournamentSize, 2) .SetParameter("ProblemSize", TripsCount) .SetParameter(Core.Island.ParameterNames.IslandsCount, 1));// Math.Floor(Math.Sqrt(TripsCount))); //.WithConflictDetector<VSConflictDetector>() //.WithCreator<VSEntityCreator>() //.WithFitness<Pea.Fitness.ParetoMultiobjective>() //.AddSelection<Pea.Selection.TournamentSelection>() //.AddReinsertion<Pea.Reinsertion.ReplaceWorstParentWithBestChildrenReinsertion>() //.WithConflictDetector<VSConflictDetector>() //.WithCreator<VSEntityCreator>() //.WithEvaluation<VSEvaluation>() //.WithFitness<Pea.Fitness.ParetoMultiobjective>() //.AddSelection<Pea.Selection.TournamentSelection>() //.AddReinsertion<Pea.Reinsertion.ReplaceWorstParentWithBestChildrenReinsertion>() //.SetParameter(Algorithm.ParameterNames.MaxNumberOfEntities, 2500) //->ProblemType //.SetParameter(Algorithm.ParameterNames.MutationProbability, 0.5) //->ProblemType //.SetParameter(Pea.Selection.ParameterNames.TournamentSize, 2) //->Algorithm //.SetParameter(Island.ParameterNames.ArchipelagosCount, 1) //.SetParameter(Island.ParameterNames.IslandsCount, 1) //.SetParameter(Island.ParameterNames.EvaluatorsCount, 2) //-> Algorithm //.SetParameter(Chromosome.ParameterNames.ConflictReducingProbability, 0.5) //->ChromosomeFactory //.SetParameter(Chromosome.ParameterNames.FailedCrossoverRetryCount, 20) //->ChromosomeFactory //.SetParameter(Chromosome.ParameterNames.FailedMutationRetryCount, 10); //->ChromosomeFactory }