private void FillLearningAlgorithmsTable(string NeuroNetName, string SelectionName) { dgwLA.Rows.Clear(); string[] names = LearningAlgorithmsLibrary.GetAllNamesOfAlgorithms(); for (int i = 0; i < LearningAlgorithmsLibrary.CountAlgorithms; i++) { dgwLA.Rows.Add(names[i]); } List <string> ls = learningInfo.FindData(NeuroNetName).FindData(SelectionName); for (int i = 0; i < dgwLA.Rows.Count; i++) { string laName = dgwLA.Rows[i].Cells[0].Value.ToString(); string laType = LearningAlgorithmsLibrary.GetNameOfTypeOfAlgoritm(laName); bool isConsist = false; foreach (string item in ls) { if (String.Compare(item, laType) == 0) { isConsist = true; break; } } if (isConsist) { dgwLA.Rows[i].Cells[1].Value = "Обучена"; } else { dgwLA.Rows[i].Cells[1].Value = "Не обучена"; } } dgwLA.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dgwLA.AutoResizeColumns(); }
private void btnUse_Click(object sender, EventArgs e) { int countInputNeurons = dbHandler.SelectCountInputParametersInTask(lbTaskSelected.Text); int countOutputNeurons = 1; ActivateFunction af = LibraryOfActivateFunctions. GetActivateFunction(dbHandler.SelectActivateFunctionTypeByNeuroNet(lbNetSelected.Text), LibraryOfActivateFunctions.GetterParameter.TypeOfActivateFunctionName); List <double> valuesOfParametersAF = dbHandler.SelectValuesOfParametersOfAF(lbNetSelected.Text); int k = 0; foreach (double item in valuesOfParametersAF) { af.SetValueOfParameter(k, item); k++; } int countNeurons = dbHandler.SelectCountNeuronsInNet(lbNetSelected.Text); bool[,] connections = new bool[countNeurons, countNeurons]; double[,] weights = new double[countNeurons, countNeurons]; List <Tuple <int, int, double> > ls = dbHandler.SelectLearnedTopology(lbNetSelected.Text, lbSelSelected.Text, LearningAlgorithmsLibrary.GetNameOfTypeOfAlgoritm(lbLASelected.Text)); for (int i = 0; i < countNeurons; i++) { for (int j = 0; j < countNeurons; j++) { connections[i, j] = false; weights[i, j] = 0.0; } } foreach (Tuple <int, int, double> item in ls) { connections[item.Item2, item.Item1] = true; weights[item.Item2, item.Item1] = item.Item3; } int[] neuronsInLayers = dbHandler.SelectNeuronsInLayers(lbNetSelected.Text); NeuroNet net = new NeuroNet(countInputNeurons, countOutputNeurons, neuronsInLayers, connections, weights, af); NeuroNetSolvingWindow solvingWnd = new NeuroNetSolvingWindow(net); solvingWnd.Show(); }