public void setSelectedPlanogramSize() { int count; using (PlanogramContext ctx = new PlanogramContext()) { MockData data = new MockData(ctx); count = data.GetItemsCount(); } if (count == SMALL_ITEMS_COUNT) { CbPlanogramSize.SelectedIndex = 0; } else if (count == LARGE_ITEMS_COUNT) { CbPlanogramSize.SelectedIndex = 1; } else { showDataPanelUntil(); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.CbPlanogramSize.Items.Clear(); this.CbPlanogramSize.ItemsSource = new List <Scale> { new Scale { ID = 1, Name = "Small", Description = "Test Scale Only (100 items, 24 slots)" }, new Scale { ID = 2, Name = "Large", Description = "Production Scale (5000 items, 288 slots)" } }; this.CbPlanogramSize.DisplayMemberPath = "NameDescription"; setSelectedPlanogramSize(); // TEMPORARY, for now we get the items at start up for debugging purposes using (PlanogramContext ctx = new PlanogramContext()) { MockData mock = new MockData(ctx); itemsCache = mock.GetItemsWithAttr(); simSettings.ItemMetricMin = mock.GetItemMinimumScore(simSettings); simSettings.ItemMetricMax = mock.GetItemMaximumScore(simSettings); } }
private void runSlmBtn_Click(object sender, RoutedEventArgs e) { selectedSlotIndex = -1; _row = -1; _col = -1; itemRow = -1; itemCol = -1; SimulationPanel simPanel = new SimulationPanel(); simPanel.SetSimSettings(simSettings); bool?result = simPanel.ShowDialog(); if (result.HasValue && result.Value == true) { // resets grid to default usePerfColor = false; FillGrid(planogram, Colors.LightGray); if (headToHead) { FillGrid(planogramTensorflow, Colors.LightGray); } // disable control buttons //statusTxt.Text = statusTxtTensor.Text = ""; statusTxtTensor.Text = "Waiting for RLM to finish running..."; EnableControlButtons(false); // set simulation settings simSettings.SimType = simPanel.SimType; simSettings.Sessions = simPanel.Sessions; simSettings.Hours = simPanel.Hours; simSettings.Score = simPanel.Score; simSettings.EnableSimDisplay = simPanel.EnableSimDisplay; simSettings.DefaultScorePercentage = simPanel.simScoreSlider.Value; simSettings.HiddenLayers = simPanel.HiddenLayers; simSettings.HiddenLayerNeurons = simPanel.HiddenLayerNeurons; targetScoreTxt.Text = ""; if (simSettings.SimType == SimulationType.Score) { targetScoreLbl.Visibility = Visibility.Visible; targetScoreTxt.Visibility = Visibility.Visible; targetScoreTxt.Text = simSettings.Score.Value.ToString("n"); targetScoreTxt2.Visibility = Visibility.Visible; targetScoreTxt2.Text = simSettings.Score.Value.ToString("n"); } else { targetScoreLbl.Visibility = Visibility.Hidden; targetScoreTxt.Visibility = Visibility.Hidden; targetScoreTxt2.Visibility = Visibility.Hidden; } if (simSettings.SimType == SimulationType.Sessions) { sessionPerBatchLbl.Visibility = Visibility.Hidden; sessionPerBatchTxt.Visibility = Visibility.Hidden; } else { sessionPerBatchLbl.Visibility = Visibility.Visible; sessionPerBatchTxt.Visibility = Visibility.Visible; } Logger.Clear(); string dbIdentifier = "RLM_planogram_" + Guid.NewGuid().ToString("N"); // instantiate visualizer with this window as its parent reference visualizer = new RLVOutputVisualizer(this); core = new RLVCore(dbIdentifier); // subscribe mainwindow to the comparison event //visualizer.LearningComparisonDisplayResultsEvent += DisplayLearningComparisonResults; // open temporary RLV container panel // todo this must be embeded in this Window instead of the temporary container if (rlvPanel != null) { rlvPanel.Close(); } rlvPanel = new TempRLVContainerPanel(core, visualizer); //this.Top = 20; //tmpPanel.Top = this.Top; //this.Height = tmpPanel.Height; //tmpPanel.Left = 10; //this.Left = tmpPanel.Width + tmpPanel.Left; //tmpPanel.Visibility = Visibility.Hidden; Task.Run(() => { // get items from db as well as the min and max metric scores as we need that for the calculation later on Item[] items; using (PlanogramContext ctx = new PlanogramContext()) { MockData mock = new MockData(ctx); items = itemsCache = mock.GetItemsWithAttr(); simSettings.ItemMetricMin = mock.GetItemMinimumScore(simSettings); simSettings.ItemMetricMax = mock.GetItemMaximumScore(simSettings); } // let's tensorflow (or other listeners) know that it should start training //OnSimulationStart?.Invoke(items, simSettings); //return; // initialize and start RLM training optimizer = new PlanogramOptimizer(items, simSettings, this.UpdateRLMResults, this.UpdateRLMStatus, Logger, dbIdentifier); //optimizer.OnSessionDone += Optimizer_OnSessionDone; optimizer.StartOptimization(tokenSource.Token); }); } }