public ArchiveSelection(models.Selection selection) { this.ID = selection.ID; this.Name = selection.Name; this.RowCount = selection.RowCount; this.Type = selection.Type; }
public SolveViewModel(models.Task task, models.TaskSolver solver) { TaskID = task.ID; SolvingList = new ObservableCollection <SolvingInstance>(); SolverName = solver.Name; TaskName = task.Name; List <LearningInfo> learningList = new List <LearningInfo>(); List <models.LearnedSolver> learnedSolvers = models.LearnedSolver.learnedSolversOfTaskSolverID(solver.ID); foreach (models.LearnedSolver learnedSolver in learnedSolvers) { models.Selection selection = (models.Selection)models.Selection.getById(learnedSolver.SelectionID, typeof(models.Selection)); List <models.LearningQuality> qualities = models.LearningQuality.qualitiesOfSolverId(learnedSolver.ID); models.LearningScenario scenario = (models.LearningScenario)models.LearningScenario.getById(learnedSolver.LearningScenarioID, typeof(models.LearningScenario)); models.TaskTemplate template = (models.TaskTemplate)models.TaskTemplate.getById(selection.TaskTemplateID, typeof(models.TaskTemplate)); models.LearningQuality quality = (qualities != null && qualities.Count > 0) ? qualities[0] : null; List <models.Parameter> parameters = models.Parameter.parametersOfTaskTemplateId(template.ID); int outputParam = 0; foreach (models.Parameter param in parameters) { if (param.IsOutput == 1) { outputParam = param.ID; break; } } learningList.Add(new LearningInfo { SelectionID = selection.ID, ParameterID = outputParam, SelectionName = selection.Name, LearningScenarioName = scenario.Name, PreprocessingName = template.Name, TestMistake = (quality != null) ? quality.MistakeTest : 0, TrainMistake = (quality != null) ? quality.MistakeTrain : 0, ClosingError = Convert.ToSingle((quality != null) ? quality.ClosingError : 0), TaskTemplate = template, LearnedSolver = learnedSolver }); } LearningList = learningList.ToArray(); addHandler = new ActionHandler(() => { SolvingList.Add(new SolvingInstance(this, this.SelectedLearning.TaskTemplate)); solveHandler.RaiseCanExecuteChanged(); saveHandler.RaiseCanExecuteChanged(); SelectedSolution = Solutions[0]; NotifyPropertyChanged("SelectedSolution"); NotifyPropertyChanged("Solutions"); }, e => SelectedLearning != null); solveHandler = new ActionHandler(Solve, e => SolvingList.Count > 0); saveHandler = new ActionHandler(saveSolutions, e => SolvingList.Count > 0); SelectedSolution = Solutions[0]; }
public SelectionLeaf(models.Task task, models.Selection selection, TaskTreeViewModel vm) { Title = selection.Name; parentTask = task.Name; deleteHandler = new ActionHandler( () => { new dms.services.preprocessing.DataHelper().deleteSelection(selection); vm.UpdateTaskTree(); }, e => true); showSelectionInfoHandler = new ActionHandler( () => { SelectionInfoViewModel t = new SelectionInfoViewModel(task.ID, selection.ID); vm.SendRequestCreateView(t); }, e => true); showSelectionLearnHandler = new ActionHandler( () => { var t = new SelectionLearnStatisticViewModel(selection, task.Name); vm.SendRequestCreateView(t); }, e => true); }