private void Step_Animate_Swarm(Color[] pColor, int s) { //Animation.GraphPane.CurveList.Clear(); for (int pType = 0; pType < 4; pType++) { double[] xx = new double[((ArrayList)AniS[s]).Count]; double[] yy = new double[((ArrayList)AniS[s]).Count]; for (int i = 0; i < ((ArrayList)AniS[s]).Count; i++) { if (((DecisionVector)((ArrayList)AniS[s])[i]).type == pType) { xx[i] = ((DecisionVector)((ArrayList)AniS[s])[i]).Objective[0]; yy[i] = ((DecisionVector)((ArrayList)AniS[s])[i]).Objective[1]; } } DrawGraph.CreateXYScatter(Animation, xx, yy, "spType" + pType.ToString(), "Animation_StepS", pColor[pType]); } if ((s % 50 == 0) || (s == Ani.Count)) { Animation.GraphPane.XAxis.Scale.MaxAuto = true; Animation.GraphPane.XAxis.Scale.MinAuto = true; Animation.GraphPane.YAxis.Scale.MaxAuto = true; Animation.GraphPane.YAxis.Scale.MinAuto = true; } else { Animation.GraphPane.XAxis.Scale.MaxAuto = false; Animation.GraphPane.XAxis.Scale.MinAuto = false; Animation.GraphPane.YAxis.Scale.MaxAuto = false; Animation.GraphPane.YAxis.Scale.MinAuto = false; } }
private void MODErun_Click(object sender, EventArgs e) { double[] index; ArrayList Average; double[] DEparas = new double[19]; ArrayList Pareto = new ArrayList(); DateTime start = DateTime.Now; DEparas[0] = Convert.ToDouble(this.DEiter.Value); DEparas[1] = Convert.ToDouble(this.DEnumVectors.Value); DEparas[2] = Convert.ToDouble(this.DEfmin.Text); DEparas[3] = Convert.ToDouble(this.DEfmax.Text); DEparas[4] = Convert.ToDouble(this.DEnb.Value); DEparas[5] = Convert.ToDouble(this.DEcrx.Text); DEparas[6] = Convert.ToDouble(this.DEcrn.Text); DEparas[9] = Convert.ToDouble(this.nElite.Text); DEparas[10] = Convert.ToDouble(this.percTopE.Text); DEparas[11] = Convert.ToDouble(this.percBotE.Text); DEparas[12] = Convert.ToDouble(this.percGapU.Text); DEparas[13] = Convert.ToDouble(this.ptype1.Text); DEparas[14] = Convert.ToDouble(this.ptype2.Text); DEparas[15] = Convert.ToDouble(this.ptype3.Text); DEparas[16] = Convert.ToDouble(this.ptype4.Text); DEparas[17] = Convert.ToDouble(this.randomS.Text); DEparas[18] = Convert.ToDouble(this.nRep.Text); //for (int strategy = 1; strategy < 7; strategy++) //for (int strategy = 5; strategy < 6; strategy++) MainClass.DE(problem, DEparas, (int)moveS.Value, this.cAnimation.Checked, out index, out Pareto, out Ani, out AniS, out Average /*, setRNTextDelegate*/); TimeSpan finish = DateTime.Now - start; DEGraph.GraphPane.CurveList.Clear(); for (int i = 0; i < Average.Count; i++) { DrawGraph.CreateXY(DEGraph, index, (double[])Average[i], pColor[i + 1], i + 1); } double[] xx = new double[Pareto.Count]; double[] yy = new double[Pareto.Count]; for (int i = 0; i < Pareto.Count; i++) { xx[i] = ((DecisionVector)Pareto[i]).Objective[0]; yy[i] = ((DecisionVector)Pareto[i]).Objective[1]; } DE_Pareto.GraphPane.CurveList.Clear(); DrawGraph.CreateXYScatter(DE_Pareto, xx, yy, "Pareto Front", "Non-dominated front", Color.Blue); //show results of computational time and #of Pareto ObjVal.Text = finish.ToString(); NumberPareto.Text = Pareto.Count.ToString(); // Enable animation function if (this.cAnimation.Checked) { this.AniStep.Enabled = true; this.AniStepRun.Enabled = true; this.DE_dynamic.Enabled = true; this.AniSpeed.Enabled = true; } else { this.AniStep.Enabled = false; this.AniStepRun.Enabled = false; this.DE_dynamic.Enabled = false; this.AniSpeed.Enabled = false; } }