public Teaching this[TeachingMethodType type] { get { return(methods[(int)type]); } }
private void updateTable() { updateGrid(); try { foreach (DataGridViewRow row in ANN_table.Rows) { if (!row.IsNewRow) { string name = row.Cells[0].Value.ToString(); int input_neurons = Convert.ToInt32(row.Cells[1].Value); int hidden_neurons = Convert.ToInt32(row.Cells[2].Value); int output_neurons = Convert.ToInt32(row.Cells[3].Value); TeachingMethodType teachingMethod = 0; string tableName = row.Cells[4].Value.ToString(); if (tableName != "" && tableName != null) { string existingName = Array.Find(Enum.GetNames(typeof(TeachingMethodType)), nm => nm == tableName); teachingMethod = (TeachingMethodType)Enum.GetValues(typeof(TeachingMethodType)).GetValue(Array.IndexOf(Enum.GetNames(typeof(TeachingMethodType)), existingName)); } else { return; } if (!ann_manager.createANN(name, input_neurons, hidden_neurons, output_neurons, teachingMethod)) { ann_manager.deleteANN(name); ann_manager.createANN(name, input_neurons, hidden_neurons, output_neurons, teachingMethod); } } } } catch (Exception) { } }
public Teacher(TeachingMethodType teachingMethodType) { doTeaching = methods[teachingMethodType]; isTeaching = false; }
public bool createANN(string name, int input_neurons_count, int hidden_neurons_count, int output_neurons_count, TeachingMethodType teachingMethod) { NeuralNetwork ann = new NeuralNetwork(input_neurons_count, hidden_neurons_count, output_neurons_count); Teacher teacher = new Teacher(teachingMethod); if (ann_table.Find(nn => nn.name == name) != null || ann.getANNInfo().isBroken) { return(false); } else { ann_table.Add(new ANN_table_item(name, ann, teacher)); return(true); } }