Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     GAWrapper.API.Data.GAAgent agent = new API.Data.GAAgent(agentName.Text);
     agent.countOfGenoms = Int32.Parse(genomsCount.Text);
     agent.countOfStartPopulation = Int32.Parse(populationCount.Text);
     agent.crossoverType = crossoverType.SelectedIndex;
     agent.maxCountOfMutatedGenoms = Int32.Parse(maxCountOfMutatedGenoms.Text);
     agent.modelOfEvolution = evolutionModel.SelectedIndex;
     agent.mutationChance = float.Parse(mutationChance.Text.Replace('.',','));
     agent.populationType = populationType.SelectedIndex;
     agent.powerOfMutation = Int32.Parse(mutationPower.Text);
     agent.Save();
 }
Example #2
0
        private void Test_Load(object sender, EventArgs e)
        {
            Dictionary<string, object> data = new Dictionary<string,object>();
            data.Add("key1", 13);
            data.Add("key2", 13.13f);
            data.Add("key3", "hello");
            data.Add("key4", new float[]{1.1f,2.2f,3.3f});

            GAWrapper.API.Core.SystemManager.SaveToFile(data, "test.txt", GAWrapper.API.Core.Profile.gaSaves);
            data.Clear();

            data = GAWrapper.API.Core.SystemManager.LoadFromFile(GAWrapper.API.Core.Profile.gaSaves, "test.txt");

            foreach (string key in data.Keys)
            {
                textBox1.Text += key + " = " + data[key].ToString() + Environment.NewLine;
            }

            GAWrapper.API.Data.GAAgent agent = new API.Data.GAAgent("hello");
            agent.Save();
        }