Exemple #1
0
 public FoldingWorkingSet(string Name, bool Hamming, GeneticAlgorithmConfig <char> GAC, Func <GeneticAlgorithm <char>, CalculationMode <char> > CM) :
     base(Name, GAC, new FoldingDefaultOperatorProvider(), new FoldingCreator(), CM)
 {
     this.CalculateHamming = Hamming;
     this.Log = new ConsoleLogger();
     //this.Log = new StreamLogger(string.Format("{0}-{1}-{2}.log", Name, GAC.PopulationSize, DateTime.Now.ToString("yyyy-MM-dd-HH-mm")));
 }
Exemple #2
0
 public SilentWorkingSet(string Name,
                         GeneticAlgorithmConfig <char> GAC,
                         IGeneticOperatorProvider <char> Provider,
                         Func <GeneticAlgorithm <char>, CalculationMode <char> > CM) :
     base(Name, GAC, Provider, new FoldingCreator(), CM)
 {
     this.Log = new StreamLogger(string.Format("{0}-{1}-{2}-{3}-{4}.log", Name, GAC.PopulationSize, GAC.CrossoverRate.ToString("F2"), GAC.MutationRate.ToString("F2"), DateTime.Now.ToString("yyyy-MM-dd-HH-mm")));;
 }
Exemple #3
0
 protected WorkingSet(string Name, GeneticAlgorithmConfig <T> GAC, IGeneticOperatorProvider <T> Provider, IFitnessMeasuredCreator <T> Creator, Func <GeneticAlgorithm <T>, C> CM)
 {
     this.Lock = new ManualResetEvent(false);
     this.Name = Name;
     this.Log  = new EmptyLogger();
     //this.Log = new StreamLogger(string.Format("{0}-{1}-{2}.log", Name, GAC.PopulationSize, DateTime.Now.ToString("yyyy-MM-dd-HH-mm")));
     this.GA = new GeneticAlgorithm <T>(GAC, Provider, Creator, Log);
     this.CalculationMode = CM(this.GA);
     this.GAC             = GAC;
 }
    void Awake()
    {
        config                 = new GeneticAlgorithmConfig();
        config.RandOptions     = new RandomizerOptions(-1, 1);
        config.PercentToSelect = PercentToSelect;
        config.MutationChance  = MutationChance;
        //config.ParentChances = Chances;
        config.SetParentChoosingMethod(parentChoosingMethod);

        Application.runInBackground = true;
    }
Exemple #5
0
        public GeneticAlgorithmConfig GetGeneticAlgorithmConfig()
        {
            var result = new GeneticAlgorithmConfig()
            {
                MutationChance  = 1,
                ParentMethod    = ParentChoosingMethod.Geom,
                PercentToSelect = 2,
                RandOptions     = GetRandomizerOptions()
            };

            return(result);
        }
Exemple #6
0
        public Classification()
        {
            GeneticAlgorithmConfig config = new GeneticAlgorithmConfig();

            config.RandOptions     = new RandomizerOptions(-1, 1, 0.2);
            config.PercentToSelect = 0.5;
            config.MutationChance  = 0.2;
            config.SetParentChoosingMethod(ParentChoosingMethod.PositionLinear);
            process = new LearningProcess(populationCount, config, new List <int> {
                2, 4, 2
            }, new List <Type>()
            {
                typeof(TanHNeuron), typeof(StepNeuron)
            });
        }
        public Perceptron()
        {
            GeneticAlgorithmConfig config = new GeneticAlgorithmConfig();

            config.RandOptions     = new RandomizerOptions(-1, 1, 0.05);
            config.PercentToSelect = 0.4;
            config.MutationChance  = 0.005;
            config.SetParentChoosingMethod(ParentChoosingMethod.Geom);
            process = new LearningProcess(populationCount, config, new List <int> {
                3, 100, 2
            }, new List <Type>()
            {
                typeof(IdentityNeuron), typeof(IdentityNeuron)
            });
        }
    public LearningProcess LoadLearningProcess(string path)
    {
        if (path == null || !File.Exists(path))
        {
            return(null);
        }

        learningProcess = Serializator.Deserialize(path);

        if (learningProcess == null)
        {
            throw new Exception("Błąd deserializacji!!!");
        }

        config = learningProcess.LearningAlgorithm.Config;
        parentChoosingMethod = config.ParentMethod;
        sigma = (float)config.RandOptions.Sigma;

        PercentToSelect = (float)config.PercentToSelect;
        MutationChance  = (float)config.MutationChance;

        List <Type> neuronTypes = new List <Type>();

        foreach (LayerBase <double> neuron in learningProcess.Population[0].Layers)
        {
            neuronTypes.Add(neuron.Neurons[0].GetType());
        }

        Debug.Log(learningProcess.Population[0].Layers[0].Neurons[0]);


        neuronDefinitionsPanelScript.
        SetNeuronDefinitions(
            learningProcess.Population[0].LayersCount,
            neuronTypes
            );

        //plot.PreviousLearningProcess(learningProcess);
        plot.RestartedSimulation(learningProcess);


        ProcessData[] histData = new ProcessData[learningProcess.HistoricalData.Count];
        learningProcess.HistoricalData.CopyTo(histData);
        GenerationList.SetGenerationHistory(new List <ProcessData>(histData));

        return(learningProcess);
    }
Exemple #9
0
 public IFitnessMeasured <char> CreateNew(GeneticAlgorithmConfig <char> GAC)
 {
     return(new Folding(GAC.Sequence.Length - 1));
 }