private void button1_Click(object sender, EventArgs e) { Parameter.p = int.Parse(textBox2.Text); Lagrange Lag = new Lagrange(); Lag.findresult(); //显示结果 label2.Text = Lag.results; label4.Text = Lag.lowbound.ToString(); //图象分析 lagrangeChartForm.chartControl1.Series.Clear(); if (checkBox1.Checked) { ChartSeries upboundSeries = new ChartSeries("upbound"); ChartSeries lowboundSeries = new ChartSeries("lowbound"); upboundSeries.SeriesIndexedModelImpl = new StringIndexedModel(upboundSeries, (double[])Lag.upbounds.ToArray(typeof(double))); lowboundSeries.SeriesIndexedModelImpl = new StringIndexedModel(lowboundSeries, (double[])Lag.lowbounds.ToArray(typeof(double))); lagrangeChartForm.chartControl1.Series.Add(upboundSeries); lagrangeChartForm.chartControl1.Series.Add(lowboundSeries); } if (checkBox2.Checked) { ChartSeries zukSeries = new ChartSeries("zuk"); ChartSeries zlkSeries = new ChartSeries("zlk"); zukSeries.SeriesIndexedModelImpl = new StringIndexedModel(zukSeries, (double[])Lag.zuks.ToArray(typeof(double))); zlkSeries.SeriesIndexedModelImpl = new StringIndexedModel(zlkSeries, (double[])Lag.zlks.ToArray(typeof(double))); lagrangeChartForm.chartControl1.Series.Add(zukSeries); lagrangeChartForm.chartControl1.Series.Add(zlkSeries); } for (int i = 0; i < lagrangeChartForm.chartControl1.Series.Count; i++) { lagrangeChartForm.chartControl1.Series[i].Type = ChartSeriesType.Line; } }
private void button1_Click(object sender, EventArgs e) { Parameter.p = int.Parse(textBox2.Text); Parameter.coverdistance = double.Parse(textBox4.Text); Lagrange Lag = new Lagrange(); Lag.findresult(); //记录结果 Parameter.opti = Lag.lowbound; Parameter.x = Lag.xj1; Parameter.y = Lag.yij1; Parameter.x_trans(); //显示结果 label2.Text = Lag.results; label4.Text = Lag.lowbound.ToString(); //图象分析 lagrangeChartForm.chartControl1.Series.Clear(); if (checkBox1.Checked) { ChartSeries upboundSeries = new ChartSeries("upbound"); ChartSeries lowboundSeries = new ChartSeries("lowbound"); upboundSeries.SeriesIndexedModelImpl = new StringIndexedModel(upboundSeries, (double[])Lag.upbounds.ToArray(typeof(double))); lowboundSeries.SeriesIndexedModelImpl = new StringIndexedModel(lowboundSeries, (double[])Lag.lowbounds.ToArray(typeof(double))); lagrangeChartForm.chartControl1.Series.Add(upboundSeries); lagrangeChartForm.chartControl1.Series.Add(lowboundSeries); } if (checkBox2.Checked) { ChartSeries zukSeries = new ChartSeries("zuk"); ChartSeries zlkSeries = new ChartSeries("zlk"); zukSeries.SeriesIndexedModelImpl = new StringIndexedModel(zukSeries, (double[])Lag.zuks.ToArray(typeof(double))); zlkSeries.SeriesIndexedModelImpl = new StringIndexedModel(zlkSeries, (double[])Lag.zlks.ToArray(typeof(double))); lagrangeChartForm.chartControl1.Series.Add(zukSeries); lagrangeChartForm.chartControl1.Series.Add(zlkSeries); } for (int i = 0; i < lagrangeChartForm.chartControl1.Series.Count; i++) { lagrangeChartForm.chartControl1.Series[i].Type = ChartSeriesType.Line; } int flag = 0; for (int i = 0; i < Parameter.n; i++) { if (Lag.xj1[i] == 1) { Parameter.x[flag] = i; flag++; } } for (int i = 0; i < Parameter.n; i++) { label10.Text = label10.Text + Parameter.x[i].ToString() + " "; } }
private void button1_Click(object sender, EventArgs e) { Parameter.coverdistance = double.Parse(textBox4.Text); Lagrange Lag = new Lagrange(); Lag.findresult(); //显示结果 int sum = 0; for (int i = 0; i < Parameter.n; i++) { sum += Lag.xj1[i]; } label2.Text = sum.ToString(); label4.Text = Lag.totalcost.ToString(); Parameter.p = sum; Parameter.opti = Lag.totalcost; Parameter.x_trans(); }