private void EvaluationButton_Click(object sender, EventArgs e) { int BCC = BoxOfParameters.Controls.Count; for (int i = 1; i < BCC; i++) { BoxOfParameters.Controls[1].Dispose(); } BoxOfParameters.Show(); string s = Function_TB.Text; F = new Graphic_Interface.Function(s); if (F.GetAllParameterNames(Values)) { ParametersNames = F.ParametersNames; for (int i = 0; i < ParametersNames.Count; i++) { Label l = new Label(); l.Text = ParametersNames[i] + " = "; l.Font = new Font("Bookman Old Style", 12); l.Size = TextRenderer.MeasureText(l.Text, l.Font); l.Top = (i + 1) * 30; l.Left = 5; BoxOfParameters.Controls.Add(l); TextBox t = new TextBox(); t.Font = l.Font; t.Top = l.Top - 5; t.Left = l.Right; t.Width = 40; t.TextAlign = HorizontalAlignment.Center; if (BG != null) { t.Text = BG.gp.AdParamValues[i][0].ToString(); } if (EF != null) { t.Text = EF.BG.gp.AdParamValues[i][0].ToString(); } BoxOfParameters.Controls.Add(t); } } }
public void CalculatePayoffsValues() { CreateNumericalPayoff(); for (int d = TotalDimensions - 1; d >= 0; d--) { for (int pl1 = 0; pl1 < N; pl1++) { for (int pl2 = 0; pl2 < N; pl2++) { if (pl1 < pl2) { for (int i = 0; i < Strategies[pl1]; i++) { for (int j = 0; j < Strategies[pl2]; j++) { string s1 = payoffs[d].Array[pl1][pl2][i][j], s2 = payoffs[d].Array[pl2][pl1][i][j], CR1 = Graphic_Interface.Analyzer.CheckValidStringDouble(s1, 0, 0, false), CR2 = Graphic_Interface.Analyzer.CheckValidStringDouble(s2, 0, 0, false); if (s1 == "") { NumericalPayoffs[d][pl1][pl2][i][j] = 0; } else { if (CR1 != "") { NumericalPayoffs[d][pl1][pl2][i][j] = Convert.ToDouble(CR1); } else { Graphic_Interface.Function F1 = new Graphic_Interface.Function(s1); List <double> V1 = new List <double>(); V1.Add(cash[pl1]); for (int k = 0; k < AdParamValues.Count; k++) { V1.Add(AdParamValues[k][pl1]); if ((d < k + 1) && (k < AdParamValues.Count - 1)) { V1[V1.Count - 1] += NumericalPayoffs[k + 1][pl1][pl2][i][j]; } } F1.GetAllParameterNames(V1); string R1 = F1.CalculateValue(); NumericalPayoffs[d][pl1][pl2][i][j] = Convert.ToDouble(R1); } } if (s2 == "") { NumericalPayoffs[d][pl2][pl1][i][j] = 0; } else { if (CR2 != "") { NumericalPayoffs[d][pl2][pl1][i][j] = Convert.ToDouble(CR2); } else { Graphic_Interface.Function F2 = new Graphic_Interface.Function(s2); List <double> V2 = new List <double>(); V2.Add(cash[pl2]); for (int k = 0; k < AdParamValues.Count; k++) { V2.Add(AdParamValues[k][pl2]); if ((d < k + 1) && (k < AdParamValues.Count - 1)) { V2[V2.Count - 1] += NumericalPayoffs[k + 1][pl2][pl1][i][j]; } } F2.GetAllParameterNames(V2); string R2 = F2.CalculateValue(); NumericalPayoffs[d][pl2][pl1][i][j] = Convert.ToDouble(R2); } } } } } } } } }