public RealRandomSearch(IEvaluation <double, double> evaluation, IStopCondition stopCondition, int?seed = null)
 {
     Result             = null;
     this.evaluation    = evaluation;
     this.stopCondition = stopCondition;
     generator          = new RealRandomGenerator(evaluation.pcConstraint, seed);
 }
 public ASimpleOptimizer(IEvaluation <Element> evaluation, AStopCondition stopCondition, AGenerator <Element> generator)
 {
     Result             = null;
     this.evaluation    = evaluation;
     this.stopCondition = stopCondition;
     this.generator     = generator;
 }
Exemple #3
0
 public BinaryRandomSearch(IEvaluation <bool> evaluation, AStopCondition stopCondition, int?seed = null)
 {
     Result             = null;
     this.evaluation    = evaluation;
     this.stopCondition = stopCondition;
     generator          = new BinaryRandomGenerator(evaluation.pcConstraint, seed);
 }
 public BinaryGreedyRSOptimizer(IEvaluation <bool> evaluation, AStopCondition stopCondition,
                                AStopCondition greedyStopCondition, int?seed = null)
     : base(evaluation, stopCondition)
 {
     generator       = new BinaryRandomGenerator(evaluation.pcConstraint, seed);
     greedyOptimizer = new BinaryGreedyOptimizer(evaluation, null, greedyStopCondition, seed);
 }
Exemple #5
0
 public GeneticAlgorithm(IEvaluation <Element, Tuple <double, double> > evaluation, IStopCondition stopCondition,
                         AGenerator <Element> generator, ASelection <Tuple <double, double> > selection, ACrossover crossover,
                         IMutation <Element> mutation, int populationSize, int?seed = null)
     : base(evaluation, stopCondition, generator, selection, crossover, mutation, populationSize,
            new OptimizationState <Element>(evaluation.tMaxValue, evaluation.lOptimalParetoFront), seed)
 {
 }
 public ClusteringGeneticAlgorithm(IEvaluation <Element, Tuple <double, double> > evaluation, IStopCondition stopCondition,
                                   AGenerator <Element> generator, ASelection <Tuple <double, double> > selection, ACrossover crossover,
                                   IMutation <Element> mutation, int populationSize, int clusters, int?seed = null)
     : base(evaluation, stopCondition, generator, selection, crossover, mutation, populationSize, seed)
 {
     no_clusters = clusters;
     rng         = seed.HasValue ? new Random(seed.Value) : new Random();
 }
 public DSMGA(IEvaluation <bool> evaluation, AStopCondition stopCondition, AGenerator <bool> generator,
              ASelection selection, ACrossover crossover, IMutation <bool> mutation, int populationSize)
     : base(evaluation, stopCondition, generator, selection, crossover, mutation, populationSize)
 {
     Combinations = GetKCombs(Enumerable.Range(0, evaluation.iSize), 2)
                    .Select(x => x.ToList()).ToList();
     ResetContingencyMatrixTable();
 }
Exemple #8
0
        public APopulationOptimizer(IEvaluation <Element> evaluation, AStopCondition stopCondition, AGenerator <Element> generator,
                                    ASelection selection, IMutation <Element> mutation, int populationSize)
            : base(evaluation, stopCondition)
        {
            this.generator = generator;
            this.selection = selection;
            this.mutation  = mutation;

            this.populationSize = populationSize;
            population          = new List <Individual <Element> >();
        }
Exemple #9
0
        public EncodedGA(IEvaluation <Element> evaluation, AStopCondition stopCondition, AGenerator <Element> generator,
                         ASelection selection, ACrossover crossover, IMutation <Element> mutation, int populationSize, int?seed)
            : base(evaluation, stopCondition)
        {
            this.generator = generator;
            this.selection = selection;
            this.mutation  = mutation;

            this.populationSize = populationSize;
            population          = new List <EncodedIndividual <Element> >();
            this.seed           = seed;
            this.crossover      = crossover;
        }
Exemple #10
0
 public GeneticAlgorithm(IEvaluation <Element> evaluation, AStopCondition stopCondition, AGenerator <Element> generator,
                         ASelection selection, ACrossover crossover, IMutation <Element> mutation, int populationSize)
     : base(evaluation, stopCondition, generator, selection, mutation, populationSize)
 {
     this.crossover = crossover;
 }
 protected virtual Node_Generator parseGenerator(AGenerator node)
 {
     return new Node_Generator(
     parseOne<PExpression,INode_Expression>(parseExpression, (PExpression)node.GetType()),
     parseOne<PExpression,INode_Expression>(parseExpression, (PExpression)node.GetBody()),
     getSource(node));
 }
 public BaldwinGeneticAlgorithm(CBinaryKnapsackEvaluation evaluation, AStopCondition stopCondition, AGenerator <bool> generator,
                                ASelection selection, ACrossover crossover, IMutation <bool> mutation, int populationSize)
     : base(evaluation, stopCondition, generator, selection, crossover, mutation, populationSize)
 {
 }
Exemple #13
0
        public GeneticAlgorithm(IEvaluation <Element, EvaluationResult> evaluation, IStopCondition stopCondition, AGenerator <Element> generator,
                                ASelection <EvaluationResult> selection, ACrossover crossover, IMutation <Element> mutation, int populationSize,
                                AOptimizationState <Element, EvaluationResult, OptimizationResult> state, int?seed = null)
            : base(evaluation, stopCondition, generator, selection, mutation, populationSize, state)
        {
            this.crossover = crossover;

            indices  = Utils.CreateIndexList(populationSize);
            shuffler = new Shuffler(seed);
        }
Exemple #14
0
 public IslandModel(IEvaluation <bool> evaluation, AStopCondition stopCondition, AGenerator <bool> generator,
                    ASelection selection, ACrossover crossover, IMutation <bool> mutation,
                    int globalPopulationSize, int islandCount, int maxNoChangeDetections,
                    APopulationCrossover <bool> populationCrossover)
     : base(evaluation, stopCondition, generator, selection, crossover, mutation, 0)
 {
     this.islandCount          = islandCount;
     this.globalPopulationSize = globalPopulationSize;
     maxNoChangeDetections     = maxNoChangeDetections;
     this.populationCrossover  = populationCrossover;
     if (globalPopulationSize % islandCount != 0)
     {
         throw new Exception("liczba wysp jest nie podzielna przez wielkosc calej populacji");
     }
 }
Exemple #15
0
 public KnapsackGA(CBinaryKnapsackEvaluation evaluation, AStopCondition stopCondition, AGenerator <bool> generator,
                   ASelection selection, ACrossover crossover, IMutation <bool> mutation, int populationSize, EffectType effType, int?seed)
     : base(evaluation, stopCondition, generator, selection, crossover, mutation, populationSize)
 {
     this.seed  = seed;
     effectType = effType;
 }
Exemple #16
0
 public NSGA2(IEvaluation <Element, Tuple <double, double> > evaluation, IStopCondition stopCondition, AGenerator <Element> generator,
              IDominationComparer dominationComparer, ACrossover crossover, IMutation <Element> mutation, int populationSize,
              int?seed = null)
     : base(evaluation, stopCondition, generator, new NSGA2Selection(2, evaluation.tMaxValue, dominationComparer, true, seed),
            crossover, mutation, populationSize, seed)
 {
 }
 public GAWithDSM(IEvaluation <bool> evaluation, AStopCondition stopCondition, AGenerator <bool> generator,
                  ASelection selection, IMutation <bool> mutation, int populationSize,
                  double crossProb, double threshold)
     : base(evaluation, stopCondition, generator, selection, new DSMCrossover(crossProb, threshold, null), mutation, populationSize)
 {
 }
Exemple #18
0
 public SamplingOptimizer(IEvaluation <Element> evaluation, AStopCondition stopCondition, AGenerator <Element> generator)
     : base(evaluation, stopCondition)
 {
     this.generator = generator;
 }
Exemple #19
0
 public GAwithDSM(IEvaluation <bool> evaluation, AStopCondition stopCondition, AGenerator <bool> generator,
                  ASelection selection, ACrossover crossover, IMutation <bool> mutation, int populationSize, int interval = 10)
     : base(evaluation, stopCondition, generator, selection, crossover, mutation, populationSize)
 {
     this.interval = interval;
     dsms          = new List <List <List <double> > >();
     if (crossover is DSMCrossover)
     {
         List <List <double> > tempDSM = new List <List <double> >();
         for (int i = 0; i < evaluation.iSize; i++)
         {
             tempDSM.Add(Enumerable.Repeat(0.0, evaluation.iSize).ToList());
         }
         ((DSMCrossover)crossover).dsm = tempDSM;
     }
 }
 public GAStallDetection(IEvaluation<Element> evaluation, AStopCondition stopCondition, AGenerator<Element> generator,
                         ASelection selection, ACrossover crossover, IMutation<Element> mutation, int populationSize, 
                         int maxNoChangeDetections)
     : base(evaluation, stopCondition, generator, selection, crossover, mutation, populationSize)
 {
     MaxNCD = maxNoChangeDetections;
 }
Exemple #21
0
        public MutatedIslandGA(IEvaluation <bool> evaluation, AStopCondition stopCondition, AGenerator <bool> generator,
                               ASelection selection, ACrossover crossover, IMutation <bool> mutation, int populationSize)
            : base(evaluation, stopCondition, generator, selection, crossover, mutation, populationSize)
        {
            var moreMutation = new BinaryBitFlipMutation(1, evaluation);
            int mutatedPop   = populationSize / 10 % 2 == 1 ? populationSize / 10 - 1 : populationSize / 10;

            mutatedPop   = mutatedPop == 0 ? 2 : mutatedPop;
            mutantIsland = new GeneticAlgorithm <bool>(evaluation, stopCondition, generator, selection, crossover, moreMutation, mutatedPop);
            mutantIsland.Initialize();
        }
Exemple #22
0
        public KnapsackGeneticAlgorithm(CBinaryKnapsackEvaluation evaluation, AStopCondition stopCondition, AGenerator <bool> generator,
                                        ASelection selection, ACrossover crossover, IMutation <bool> mutation, int populationSize)
            : base(evaluation, stopCondition, generator, selection, crossover, mutation, populationSize)
        {
            var emptySolution = Enumerable.Repeat(false, evaluation.iSize).ToList();

            CheckNewBest(emptySolution, 0.0, true);
        }
Exemple #23
0
 public SamplingOptimizer(IEvaluation <Element, double> evaluation, IStopCondition stopCondition, AGenerator <Element> generator)
     : base(evaluation, stopCondition, new OptimizationState <Element>(evaluation.tMaxValue))
 {
     this.generator = generator;
 }
Exemple #24
0
 public ResettingGA(IEvaluation <Element> evaluation, AStopCondition stopCondition, AGenerator <Element> generator,
                    ASelection selection, ACrossover crossover, IMutation <Element> mutation, int populationSize, int patience, int?seed = null)
     : base(evaluation, stopCondition, generator, selection, crossover, mutation, populationSize)
 {
     this.patience = patience;
     rng           = seed.HasValue ? new Random(seed.Value) : new Random();
 }