Exemplo n.º 1
0
 public Algorithm(int generation, double probability, AlgorithmType type, IParentSelection parentSelection)
 {
     numberOfGenerations   = generation;
     probabilityOfMutation = probability;
     typeOfAlgorithm       = type;
     this.parentSelection  = parentSelection;
 }
Exemplo n.º 2
0
 public Generation(List <Individual> population, double probability, AlgorithmType type, IParentSelection parentSelection)
 {
     startingPopulation    = population;
     probabilityOfMutation = probability;
     typeOfAlgorithm       = type;
     this.parentSelection  = parentSelection;
 }
Exemplo n.º 3
0
 public Generation(Individual[] currentPopulation, Cities cities, IParentSelection parentSelection, ICrossover crossoverOperator, IMutation methodOfMutation)
 {
     this.population        = currentPopulation;
     this.cities            = cities;
     this.parentSelection   = parentSelection;
     this.crossoverOperator = crossoverOperator;
     this.methodOfMutation  = methodOfMutation;
 }
Exemplo n.º 4
0
 public Algorithm(int generation, int execution, double probability, AlgorithmType type, IParentSelection parentSelection)
 {
     numberOfGenerations = generation;
     numberOfExecution = execution;
     probabilityOfMutation = probability;
     typeOfAlgorithm = type;
     arrayOfBestResults = new double[execution];
     this.parentSelection = parentSelection;
 }
Exemplo n.º 5
0
 public TSPAlgorithm(int numberOfGenerations, int populationSize, Cities cities,
                     IParentSelection parentSelection, IMutation methodOfMutation, ICrossover crossoverOperator)
 {
     this.numberOfGenerations = numberOfGenerations;
     this.populationSize      = populationSize;
     this.cities            = cities;
     this.parentSelection   = parentSelection;
     this.crossoverOperator = crossoverOperator;
     this.methodOfMutation  = methodOfMutation;
     this.bestResults       = new double[numberOfGenerations];
 }
Exemplo n.º 6
0
 public SolutionStrategyFactory(
     IRandomSolutionGenerator randomSolutionGenerator,
     IParentSelection parentSelection,
     IRecombination recombination,
     IBestSolutionFinder bestSolutionFinder,
     IMutation mutation,
     ISolutionEvaluator solutionEvaluator,
     IAdptiveChanceAdjuster adptiveChanceAdjuster,
     ICSVFileWriter csvFileWriter
     )
 {
     this.randomSolutionGenerator = randomSolutionGenerator;
     this.parentSelection         = parentSelection;
     this.recombination           = recombination;
     this.bestSolutionFinder      = bestSolutionFinder;
     this.mutation              = mutation;
     this.solutionEvaluator     = solutionEvaluator;
     this.adptiveChanceAdjuster = adptiveChanceAdjuster;
     this.csvFileWriter         = csvFileWriter;
 }
        public EvolutionarySolution(
            IRandomSolutionGenerator randomSolutionGenerator,
            IParentSelection parentSelection,
            IRecombination recombination,
            IBestSolutionFinder bestSolutionFinder,
            IMutation mutation,
            ISolutionEvaluator solutionEvaluator,
            IAdptiveChanceAdjuster adptiveChanceAdjuster
            )
        {
            this.randomSolutionGenerator = randomSolutionGenerator;
            this.parentSelection         = parentSelection;
            this.recombination           = recombination;
            this.bestSolutionFinder      = bestSolutionFinder;
            this.mutation              = mutation;
            this.solutionEvaluator     = solutionEvaluator;
            this.adptiveChanceAdjuster = adptiveChanceAdjuster;

            solutions = new Dictionary <int, Solution>();

            parentPopulation    = new List <Solution>();
            offspringPopulation = new List <Solution>();
        }
 public void SetUp()
 {
     // This can't be good practice. is there a way to set a constant value both locally and temporarily?
     EvolutionaryAlgorithmConstants.TOURNAMENT_SIZE = 5;
     parentSelection = new ParentSelection();
 }