private void Button_Click_1(object sender, RoutedEventArgs e) { spl = new SPL(); spl.GenerateSample(); MessageBox.Show("使用样本模型成功 ◑▂◐"); PassValuesEventArgs args = new PassValuesEventArgs(spl); PassValuesEvent(this, args); this.Close(); }
// Initialize parameters like popSize,chromoLength public void Init(double mutationRate, double crossoverRate, double leftPoint, double rightPoint, int PSize, int QSize, int maxGeneration, SPL spl, int GenomeLength, int preciseLevel = 0) { this.mutationRate = mutationRate; this.crossoverRate = crossoverRate; this.leftPoint = leftPoint; this.rightPoint = rightPoint; this.PSize = PSize; this.QSize = QSize; this.maxGeneration = maxGeneration; this.spl = spl; //Calculate the length of each genome //int i = 0; //while (Math.Pow(2, i) < (rightPoint - leftPoint) * Math.Pow(10, preciseLevel)) //{ // i++; //} Genome g = new Genome(); g.SetLength(GenomeLength); Console.WriteLine("初始化完成,染色体编码共{0}位", GenomeLength); RSize = PSize + QSize; popP = new Population(PSize); popQ = new Population(QSize); popR = new Population(RSize); RandomlyGenerate(ref popQ); //ExcludeTheSame(ref popQ); ExcludeTheIllegal(ref popQ); RandomlyGenerate(ref popP); //ExcludeTheSame(ref popP); ExcludeTheIllegal(ref popP); generation = 0; bestFitness = 0; worstFitness = 99999999; averageFitness = 0; maxIndicator = 999999999999; minIndicator = 0; }
private void Button_Click(object sender, RoutedEventArgs e) { MessageBox.Show("开始-生成. 布-里 ●▂● "); spl = new SPL(); spl.maxFeature = int.Parse(max.Text); spl.maxConstraint = int.Parse(constraint.Text); spl.RandomlyGenerate(); spl.RandomConstraint(); MessageBox.Show("生成-完毕 布里布里◑▂◐\n共生成节点" + spl.aFeaturePoint.Count + "个\n约束条件" + spl.aConstraint.Count + "条.. 兹--"); PassValuesEventArgs args = new PassValuesEventArgs(spl); PassValuesEvent(this, args); this.Close(); }
public PassValuesEventArgs(SPL spl) { this.spl = spl; }
//--- Receive values from Generator subindow private void ReceiveValues(object sender, PassValuesEventArgs e) { this.spl = e.spl; SetArgsWithSPL(); }