private List <Entity> binarizationValues(List <Entity> values, int paramId, int newSelectionId, int parameterPosition) { DataHelper helper = new DataHelper(); List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", newSelectionId.ToString()), typeof(SelectionRow)); List <Entity> listValues = new List <Entity>(); List <string> valueStr = new List <string>(); foreach (Entity value in values) { valueStr.Add(((ValueParameter)value).Value); } EnumeratedParameter p = new EnumeratedParameter(valueStr); int index = 0; foreach (string value in valueStr) { int i = p.GetInt(value); string val = binarization(parameterPosition == i); listValues.Add(helper.addValueParameter(selectionRows[index].ID, paramId, val)); index++; } DatabaseManager.SharedManager.insertMultipleEntities(listValues); return(listValues); }
private void normalizeValues(List <Entity> values, IParameter p, int paramId, int newSelectionId, string prepType) { List <Entity> listValues = new List <Entity>(); DataHelper helper = new DataHelper(); List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", newSelectionId.ToString()), typeof(SelectionRow)); int index = 0; foreach (Entity value in values) { string val; switch (prepType) { case "Линейная нормализация 1 (к float)": val = normalize(1, value, p); break; case "Нелинейная нормализация 2 (к float)": val = normalize(2, value, p); break; case "нормализация 3 (к int)": val = normalize(3, value, p); break; default: val = ""; break; } listValues.Add(helper.addValueParameter(selectionRows[index].ID, paramId, val)); index++; } DatabaseManager.SharedManager.insertMultipleEntities(listValues); }
public List <string> getAppropriateValues(List <string> obtainedValues, int selectionId, int parameterId) { // // float valueDec = Convert.ToSingle(value.Replace(".", ",")); //Формируем выборку для заданного параметра List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", selectionId.ToString()), typeof(SelectionRow)); List <float> valuesForCurrParameter = new List <float>(); foreach (Entity selRow in selectionRows) { int selectionRowId = selRow.ID; List <Entity> valueForParamFromRow = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select) .addCondition("ParameterID", "=", parameterId.ToString()) .addCondition("SelectionRowID", "=", selectionRowId.ToString()), typeof(ValueParameter)); string numberStr = ((ValueParameter)valueForParamFromRow[0]).Value; float number = Convert.ToSingle(numberStr.Replace(".", ",")); valuesForCurrParameter.Add(number); } valuesForCurrParameter.Sort(); //находим в выборке соответсвующее значение для value (переданного аргумента) и присваиваем его appropriateValue float step = 0; List <string> appropriateValues = new List <string>(); for (int j = 0; j < obtainedValues.Count; j++) { float obtainedValue = Convert.ToSingle(obtainedValues[j].Replace(".", ",")); float prev = valuesForCurrParameter[0]; for (int i = 1; i < valuesForCurrParameter.Count; i++) { float next = valuesForCurrParameter[i]; step = Math.Abs(next - prev); if ((obtainedValue - prev) <= (step / 2)) { appropriateValues.Add(prev.ToString()); break; } prev = next; } //проверка на выод за границу диапозона значений в выборке ??? if (appropriateValues[j].Equals("")) { float firstVal = valuesForCurrParameter[0]; float lastVal = valuesForCurrParameter[valuesForCurrParameter.Count - 1]; if (obtainedValue >= lastVal) { appropriateValues[j] = lastVal.ToString(); } else if (obtainedValue <= firstVal) { appropriateValues[j] = firstVal.ToString(); } } } return(appropriateValues); }
private void updateTable(int taskTemplateId) { //рисуем заголовки List <Entity> parameters = models.Parameter.where (new Query("Parameter").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateID", "=", taskTemplateId.ToString()), typeof(models.Parameter)); originalColumns = new string[parameters.Count]; for (int i = 0; i < parameters.Count; i++) { models.Parameter parameter = (models.Parameter)parameters[i]; originalColumns[i] = parameter.Name; } //рисуем содержимое int rows = 100; if (CountRows < 100) { rows = CountRows; } originalData = new string[rows][]; for (int i = 0; i < rows; i++) { originalData[i] = new string[parameters.Count]; } List <Entity> sels = Selection.where (new Query("Selection").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateID", "=", taskTemplateId.ToString()) .addCondition("Name", "=", SelectionName), typeof(Selection)); if (sels.Count != 0) { List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", sels[0].ID.ToString()), typeof(SelectionRow)); int stepRow = 0; foreach (Entity selRow in selectionRows) { List <Entity> valueParam = new List <Entity>(); int selectionRowId = selRow.ID; int stepParam = 0; foreach (Entity param in parameters) { int paramId = param.ID; List <Entity> value = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select) .addCondition("ParameterID", "=", paramId.ToString()). addCondition("SelectionRowID", "=", selectionRowId.ToString()), typeof(ValueParameter)); originalData[stepRow][stepParam] = ((ValueParameter)value[0]).Value; stepParam++; } stepRow++; if (stepRow >= rows) { break; } } } }
public void deleteSelection(Entity selection) { List <Entity> listForDelete = new List <Entity>(); int templateId = ((Selection)selection).TaskTemplateID; TaskTemplate template = ((TaskTemplate)services.DatabaseManager.SharedManager.entityById(templateId, typeof(TaskTemplate))); List <Entity> taskTemplates = TaskTemplate.where (new Query("TaskTemplate").addTypeQuery(TypeQuery.select) .addCondition("TaskID", "=", template.TaskID.ToString()), typeof(TaskTemplate)); List <Entity> selections = new List <Entity>(); foreach (Entity entity in taskTemplates) { List <Entity> sels = TaskTemplate.where (new Query("Selection").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateId", "=", entity.ID.ToString()) .addCondition("Name", "=", ((Selection)selection).Name), typeof(Selection)); if (sels.Count == 0) { continue; } else { listForDelete = listForDelete.Concat(sels).ToList(); selections = selections.Concat(sels).ToList(); } } foreach (Entity sel in selections) { List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", sel.ID.ToString()), typeof(SelectionRow)); listForDelete = listForDelete.Concat(selectionRows).ToList(); for (int i = 0; i < selectionRows.Count; i++) { List <Entity> values = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select) .addCondition("SelectionRowID", "=", selectionRows[i].ID.ToString()), typeof(ValueParameter)); listForDelete = listForDelete.Concat(values).ToList(); } List <Entity> learnedSolverList = LearnedSolver.where (new Query("LearnedSolver").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", sel.ID.ToString()), typeof(LearnedSolver)); listForDelete = listForDelete.Concat(learnedSolverList).ToList(); foreach (Entity lSolver in learnedSolverList) { List <Entity> learningQualityList = LearningQuality.where (new Query("LearningQuality").addTypeQuery(TypeQuery.select) .addCondition("LearnedSolverID", "=", lSolver.ID.ToString()), typeof(LearningQuality)); listForDelete = listForDelete.Concat(learningQualityList).ToList(); } } DatabaseManager.SharedManager.deleteMultipleEntities(listForDelete); }
public List <List <Object> > getListValues(int selectionId) { Selection selection = ((Selection)dms.services.DatabaseManager.SharedManager.entityById(selectionId, typeof(Selection))); int taskTemplateId = selection.ID; List <Entity> parameters = dms.models.Parameter.where (new Query("Parameter").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateID", "=", taskTemplateId.ToString()), typeof(dms.models.Parameter)); List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", selectionId.ToString()), typeof(SelectionRow)); List <List <Object> > values = new List <List <Object> >(); int stepRow = 0; foreach (Entity selRow in selectionRows) { int selectionRowId = selRow.ID; int stepParam = 0; foreach (Entity param in parameters) { TypeParameter type = ((dms.models.Parameter)param).Type; int paramId = param.ID; List <Entity> value = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select) .addCondition("ParameterID", "=", paramId.ToString()). addCondition("SelectionRowID", "=", selectionRowId.ToString()), typeof(ValueParameter)); switch (type) { case TypeParameter.Real: values[stepRow][stepParam] = Convert.ToDouble((((ValueParameter)value[0]).Value).Replace(".", ",")); break; case TypeParameter.Int: values[stepRow][stepParam] = Convert.ToInt32(((ValueParameter)value[0]).Value); break; case TypeParameter.Enum: values[stepRow][stepParam] = ((ValueParameter)value[0]).Value; break; default: break; } stepParam++; } stepRow++; } return(values); }
public void deleteTask(Entity task) { List <Entity> listForDelete = new List <Entity>(); listForDelete.Add(task); List <Entity> templates = TaskTemplate.where (new Query("TaskTemplate").addTypeQuery(TypeQuery.select) .addCondition("TaskID", "=", task.ID.ToString()), typeof(TaskTemplate)); listForDelete = listForDelete.Concat(templates).ToList(); foreach (Entity template in templates) { List <Entity> parameters = models.Parameter.where (new Query("Parameter").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateID", "=", template.ID.ToString()), typeof(models.Parameter)); listForDelete = listForDelete.Concat(parameters).ToList(); List <Entity> selections = Selection.where (new Query("Selection").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateID", "=", template.ID.ToString()), typeof(Selection)); listForDelete = listForDelete.Concat(selections).ToList(); foreach (Entity selection in selections) { List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", selection.ID.ToString()), typeof(SelectionRow)); listForDelete = listForDelete.Concat(selectionRows).ToList(); for (int i = 0; i < selectionRows.Count; i++) { List <Entity> values = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select) .addCondition("SelectionRowID", "=", selectionRows[i].ID.ToString()), typeof(ValueParameter)); listForDelete = listForDelete.Concat(values).ToList(); } List <Entity> learnedSolverList = LearnedSolver.where (new Query("LearnedSolver").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", selection.ID.ToString()), typeof(LearnedSolver)); listForDelete = listForDelete.Concat(learnedSolverList).ToList(); foreach (Entity lSolver in learnedSolverList) { List <Entity> learningQualityList = LearningQuality.where (new Query("LearningQuality").addTypeQuery(TypeQuery.select) .addCondition("LearnedSolverID", "=", lSolver.ID.ToString()), typeof(LearningQuality)); listForDelete = listForDelete.Concat(learningQualityList).ToList(); } } } DatabaseManager.SharedManager.deleteMultipleEntities(listForDelete); }
private void processWithoutPreprocessing(List <Entity> values, int paramId, int newSelectionId) { DataHelper helper = new DataHelper(); List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", newSelectionId.ToString()), typeof(SelectionRow)); int index = 0; List <Entity> listValues = new List <Entity>(); foreach (Entity value in values) { string val = withoutPreprocessing(value); listValues.Add(helper.addValueParameter(selectionRows[index].ID, paramId, val)); index++; } DatabaseManager.SharedManager.insertMultipleEntities(listValues); }
public List <string> getClasses(int oldSelectionId, int newTemplateId, int oldParamId) { models.Parameter oldParam = ((models.Parameter)services.DatabaseManager.SharedManager.entityById(oldParamId, typeof(models.Parameter))); List <Entity> oldSelectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", oldSelectionId.ToString()), typeof(SelectionRow)); List <string> oldValuesForOldParamId = new List <string>(); foreach (Entity selRow in oldSelectionRows) { int selectionRowId = selRow.ID; List <Entity> value = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select) .addCondition("ParameterID", "=", oldParamId.ToString()). addCondition("SelectionRowID", "=", selectionRowId.ToString()), typeof(ValueParameter)); oldValuesForOldParamId.Add(((ValueParameter)value[0]).Value); } EnumeratedParameter p = new EnumeratedParameter(oldValuesForOldParamId); List <string> classes = p.getClasses(); return(classes); }
private void learnSolver() { foreach (LearningModel learningModel in LearningList) { TaskTemplate taskTemplate = (TaskTemplate)TaskTemplate.where (new Query("TaskTemplate").addTypeQuery(TypeQuery.select) .addCondition("Name", "=", learningModel.SelectedPreprocessing), typeof(TaskTemplate))[0]; Selection selection = (Selection)Selection.where (new Query("Selection").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateID", "=", taskTemplate.ID.ToString()) .addCondition("Name", "=", learningModel.SelectedSelection), typeof(Selection))[0]; int countRows = selection.RowCount; LearningScenario learningScenario = (LearningScenario)LearningScenario.where (new Query("LearningScenario").addTypeQuery(TypeQuery.select) .addCondition("Name", "=", learningModel.SelectedScenario), typeof(LearningScenario))[0]; List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", selection.ID.ToString()), typeof(SelectionRow)); List <Entity> parameters = dms.models.Parameter.where (new Query("Parameter").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateID", "=", selection.TaskTemplateID.ToString()), typeof(dms.models.Parameter)); int stepRow = 0; float[][] inputData = new float[countRows][]; float[] outputData = new float[countRows]; for (int i = 0; i < countRows; i++) { inputData[i] = new float[parameters.Count - 1]; } int outputParam = 0; for (int i = 0; i < parameters.Count; i++) { if (((models.Parameter)parameters[i]).IsOutput == 1) { outputParam = parameters[i].ID; } } string[][] vals = Selection.valuesOfSelectionId(selection.ID); float[][] fvals = new float[selection.RowCount][]; for (int i = 0; i < selection.RowCount; i++) { fvals[i] = new float[parameters.Count]; for (int j = 0; j < parameters.Count - 1; j++) { inputData[i][j] = float.Parse(vals[i][j].Replace(".", ",")); } outputData[i] = float.Parse(vals[i][parameters.Count - 1].Replace(".", ",")); } ISolver isolver = null; if (Solver.Description is PerceptronTopology) { PerceptronTopology topology = Solver.Description as PerceptronTopology; isolver = new PerceptronManaged(topology); } else if (Solver.Description is ConvNNTopology) { ConvNNTopology topology = Solver.Description as ConvNNTopology; isolver = new ConvNNManaged(topology); } else if (Solver.Description is WardNNTopology) { WardNNTopology topology = Solver.Description as WardNNTopology; isolver = new WardNNManaged(topology); } else if (Solver.Description is KohonenNNTopology) { KohonenNNTopology topology = Solver.Description as KohonenNNTopology; isolver = new KohonenManaged(topology); } else if (Solver.Description is TreeDescription) { TreeDescription topology = Solver.Description as TreeDescription; isolver = new DecisionTree(topology); } else if (Solver.Description is TreeDescriptionC4_5) { TreeDescriptionC4_5 topology = Solver.Description as TreeDescriptionC4_5; isolver = new DecisionTreeC4_5(topology); } else { throw new EntryPointNotFoundException(); } SeparationOfDataSet s = new SeparationOfDataSet(isolver, learningScenario, inputData, outputData); LearnedSolver ls = new LearnedSolver() { SelectionID = selection.ID, LearningScenarioID = learningScenario.ID, TaskSolverID = Solver.ID, Soul = s.separationAndLearn(selection.ID, outputParam) }; ls.save(); LearningQuality lq = new LearningQuality() { LearnedSolverID = ls.ID, MistakeTrain = Convert.ToInt32(s.MistakeTrain), MistakeTest = Convert.ToInt32(s.MistakeTest), ClosingError = s.ClosingError }; lq.save(); } OnClose?.Invoke(this, null); }
private void learnSolver() { foreach (LearningModel learningModel in LearningList) { TaskTemplate taskTemplate = (TaskTemplate)TaskTemplate.where (new Query("TaskTemplate").addTypeQuery(TypeQuery.select) .addCondition("Name", "=", learningModel.SelectedPreprocessing), typeof(TaskTemplate))[0]; Selection selection = (Selection)Selection.where (new Query("Selection").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateID", "=", taskTemplate.ID.ToString()) .addCondition("Name", "=", learningModel.SelectedSelection), typeof(Selection))[0]; int countRows = selection.RowCount; LearningScenario learningScenario = (LearningScenario)LearningScenario.where (new Query("LearningScenario").addTypeQuery(TypeQuery.select) .addCondition("Name", "=", learningModel.SelectedScenario), typeof(LearningScenario))[0]; List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", selection.ID.ToString()), typeof(SelectionRow)); List <Entity> parameters = dms.models.Parameter.where (new Query("Parameter").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateID", "=", selection.TaskTemplateID.ToString()), typeof(dms.models.Parameter)); int stepRow = 0; float[][] inputData = new float[countRows][]; float[] outputData = new float[countRows]; for (int i = 0; i < countRows; i++) { inputData[i] = new float[parameters.Count - 1]; } int outputParam = 0; foreach (Entity selRow in selectionRows) { int selectionRowId = selRow.ID; int stepParam = 0; foreach (Entity param in parameters) { int paramId = param.ID; List <Entity> value = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select) .addCondition("ParameterID", "=", paramId.ToString()). addCondition("SelectionRowID", "=", selectionRowId.ToString()), typeof(ValueParameter)); if (((dms.models.Parameter)param).IsOutput == 1) { outputParam = param.ID; string outputValue = ((ValueParameter)value[0]).Value; float outputFloat; if (float.TryParse(outputValue, out outputFloat)) { outputData[stepRow] = outputFloat; } } else { inputData[stepRow][stepParam] = float.Parse(((ValueParameter)value[0]).Value, CultureInfo.InvariantCulture.NumberFormat); } stepParam++; } stepRow++; } ISolver isolver = null; if (Solver.Description is PerceptronTopology) { PerceptronTopology topology = Solver.Description as PerceptronTopology; isolver = new PerceptronManaged(topology); } else if (Solver.Description is ConvNNTopology) { ConvNNTopology topology = Solver.Description as ConvNNTopology; isolver = new ConvNNManaged(topology); } else if (Solver.Description is WardNNTopology) { WardNNTopology topology = Solver.Description as WardNNTopology; isolver = new WardNNManaged(topology); } else if (Solver.Description is TreeDescription) { TreeDescription topology = Solver.Description as TreeDescription; isolver = new DecisionTree(topology); } else { throw new EntryPointNotFoundException(); } SeparationOfDataSet s = new SeparationOfDataSet(isolver, learningScenario, inputData, outputData); LearnedSolver ls = new LearnedSolver() { SelectionID = selection.ID, LearningScenarioID = learningScenario.ID, TaskSolverID = Solver.ID, Soul = s.separationAndLearn(selection.ID, outputParam) }; ls.save(); LearningQuality lq = new LearningQuality() { LearnedSolverID = ls.ID, MistakeTrain = Convert.ToInt32(s.MistakeTrain), MistakeTest = Convert.ToInt32(s.MistakeTest), ClosingError = s.ClosingError }; lq.save(); } OnClose?.Invoke(this, null); }
public Dictionary <List <Entity>, IParameter> executePreprocessing(int newSelectionId, int oldSelectionId, int oldParamId, string prepType, int parameterPosition, int newParamId) { models.Parameter oldParam = ((models.Parameter)DatabaseManager.SharedManager.entityById(oldParamId, typeof(models.Parameter))); TypeParameter type; switch (prepType) { case "Линейная нормализация 1 (к float)": type = TypeParameter.Real; break; case "Нелинейная нормализация 2 (к float)": type = TypeParameter.Real; break; case "нормализация 3 (к int)": type = TypeParameter.Int; break; case "бинаризация": type = TypeParameter.Int; break; case "без предобработки": type = oldParam.Type; break; default: type = TypeParameter.Real; break; } List <string> values = new List <string>(); List <Entity> valueParam = new List <Entity>(); List <Entity> oldSelectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", oldSelectionId.ToString()), typeof(SelectionRow)); int index = 0; foreach (Entity entity in oldSelectionRows) { int selectionRowId = entity.ID; List <Entity> list = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select) .addCondition("ParameterID", "=", oldParamId.ToString()). addCondition("SelectionRowID", "=", selectionRowId.ToString()), typeof(ValueParameter)); valueParam = valueParam.Concat(list).ToList(); values.Add(((ValueParameter)valueParam[index]).Value); index++; } List <Entity> valuesForParameter = new List <Entity>(); IParameter p = null; switch (prepType) { case "Линейная нормализация 1 (к float)": case "Нелинейная нормализация 2 (к float)": case "нормализация 3 (к int)": if (oldParam.Type == TypeParameter.Real) { p = new RealParameter(values); valuesForParameter = normalizeValues(valueParam, p, newParamId, newSelectionId, prepType); } else if (oldParam.Type == TypeParameter.Int) { p = new IntegerParameter(values); valuesForParameter = normalizeValues(valueParam, p, newParamId, newSelectionId, prepType); } else if (oldParam.Type == TypeParameter.Enum) { p = new EnumeratedParameter(values); valuesForParameter = normalizeValues(valueParam, p, newParamId, newSelectionId, prepType); } break; case "бинаризация": valuesForParameter = binarizationValues(valueParam, newParamId, newSelectionId, parameterPosition); break; case "без предобработки": valuesForParameter = processWithoutPreprocessing(valueParam, newParamId, newSelectionId); break; } Dictionary <List <Entity>, IParameter> res = new Dictionary <List <Entity>, IParameter>(); res.Add(valuesForParameter, p); return(res); }
public Object[][] getValues(int selectionId) { Selection selection = ((Selection)dms.services.DatabaseManager.SharedManager.entityById(selectionId, typeof(Selection))); int taskTemplateId = selection.ID; List <Entity> parameters = dms.models.Parameter.where (new Query("Parameter").addTypeQuery(TypeQuery.select) .addCondition("TaskTemplateID", "=", taskTemplateId.ToString()), typeof(dms.models.Parameter)); List <Entity> inputParams = new List <Entity>(); List <Entity> outputParams = new List <Entity>(); foreach (Entity param in parameters) { models.Parameter p = (models.Parameter)param; if (p.IsOutput == 0) { inputParams.Add(param); } else { outputParams.Add(param); } } List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select) .addCondition("SelectionID", "=", selectionId.ToString()), typeof(SelectionRow)); Object[][] valuesX = new Object[selectionRows.Count][]; Object[][] valuesY = new Object[selectionRows.Count][]; int stepRow = 0; foreach (Entity selRow in selectionRows) { for (int i = 0; i < 2; i++) { if (i == 0) { valuesX[stepRow] = new Object[inputParams.Count]; parameters = inputParams; } else { valuesY[stepRow] = new Object[outputParams.Count]; parameters = outputParams; } int selectionRowId = selRow.ID; int stepParam = 0; foreach (Entity param in parameters) { TypeParameter type = ((dms.models.Parameter)param).Type; int paramId = param.ID; List <Entity> value = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select) .addCondition("ParameterID", "=", paramId.ToString()). addCondition("SelectionRowID", "=", selectionRowId.ToString()), typeof(ValueParameter)); if (i == 0) { switch (type) { case TypeParameter.Real: valuesX[stepRow][stepParam] = Convert.ToDouble((((ValueParameter)value[0]).Value).Replace(".", ",")); break; case TypeParameter.Int: valuesX[stepRow][stepParam] = Convert.ToInt32(((ValueParameter)value[0]).Value); break; case TypeParameter.Enum: valuesX[stepRow][stepParam] = ((ValueParameter)value[0]).Value; break; default: break; } } else { switch (type) { case TypeParameter.Real: valuesY[stepRow][stepParam] = Convert.ToDouble((((ValueParameter)value[0]).Value).Replace(".", ",")); break; case TypeParameter.Int: valuesY[stepRow][stepParam] = Convert.ToInt32(((ValueParameter)value[0]).Value); break; case TypeParameter.Enum: valuesY[stepRow][stepParam] = ((ValueParameter)value[0]).Value; break; default: break; } } stepParam++; } } stepRow++; } return(null);//values; }