コード例 #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string dbIdentifier = "RLV_small";

            // instantiate visualizer with this window as its parent reference
            visualizer = new RLVOutputVisualizer(this);
            core       = new RLVCore(dbIdentifier);

            this.Top = 20;
            rlvPanel = new VisualizerWindow(core, visualizer);
        }
コード例 #2
0
        public VisualizerWindow(IRLVCore core, int maxMoves, IEnumerable <MoveDetails> predictedMoves)
            : this(core)
        {
            this.maxMoves       = maxMoves;
            this.predictedMoves = predictedMoves;

            this.radioAllMoves.IsChecked    = true;
            this.radioRecentMoves.IsChecked = false;

            this.allMoves = new List <MoveDetails>();

            ToggleComparisonMode(false);
        }
コード例 #3
0
        public VisualizerWindow(IRLVCore core)
        {
            InitializeComponent();

            this.core       = core;
            this.visualizer = new RLVOutputVisualizer(this);

            IRLVScaleSelectionVM scaleVM = new RLVScaleSelectionVM();

            detailsScalePanel = rlv.DetailsControl.ScalePanel;
            chartScalePanel   = rlv.ChartControl.ScalePanel;

            detailsScalePanel.SetViewModel(scaleVM);
            chartScalePanel.SetViewModel(scaleVM);
            scaleVM.DefaultScale = 100;

            core.SetupVisualizer(new List <IRLVPanel>
            {
                rlv.DetailsControl,
                rlv.ChartControl,
                chartScalePanel,
                detailsScalePanel
            }, visualizer);

            this.Closing += VisualizerWindow_Closing;

            notifier = new Notifier(cfg =>
            {
                cfg.PositionProvider = new WindowPositionProvider(
                    parentWindow: this,
                    corner: Corner.TopRight,
                    offsetX: 10,
                    offsetY: 10);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(3),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(5));

                cfg.Dispatcher = Application.Current.Dispatcher;
            });
        }
コード例 #4
0
        public MainWindow()
        {
            InitializeComponent();
            headToHead = false;
            Width      = 580;
            //toggleColorBtn.Margin = new Thickness(422, 14, 0, 0); //new Thickness(62, 10, 0, 0);
            //dataGenerationBtn.Margin = new Thickness(24, 14, 0, 0); //new Thickness(182, 10, 0, 0);
            //metricsBtn.Margin = new Thickness(146, 14, 0, 0); //new Thickness(302, 10, 0, 0);
            //runSlmBtn.Margin = new Thickness(266, 14, 0, 0); //new Thickness(422, 10, 0, 0);

            rectHeadToHeadDivider.Visibility = Visibility.Hidden;

            planogramTensorflow.Visibility = Visibility.Hidden;


            tensorFlowPlanogramScore.Visibility = Visibility.Hidden;
            GrdTensorFlowsetting.Visibility     = Visibility.Hidden;
            grpBox_Tensorflow.Visibility        = Visibility.Hidden;

            FillGrid(planogram, Colors.LightGray);
            //For testing only
            string dbIdentifier = "RLV_small";

            // instantiate visualizer with this window as its parent reference
            visualizer = new RLVOutputVisualizer(this);
            core       = new RLVCore(dbIdentifier);

            //core.SetupVisualizer(new List<IRLVPanel>
            //{
            //    detailsPanel,
            //    chartPanel
            //}, visualizer);

            //this.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml") });
            //this.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml") });
            //this.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml") });
            //this.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml") });
            //this.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml") });
        }
コード例 #5
0
        public TempRLVContainerPanel(IRLVCore core, IRLVOutputVisualizer visualizer)
        {
            InitializeComponent();

            this.core       = core;
            this.visualizer = visualizer;

            IRLVScaleSelectionVM scaleVM = new RLVScaleSelectionVM();

            detailsScalePanel = detailsControl.ScalePanel;
            chartScalePanel   = progressionChartControl.ScalePanel;

            detailsScalePanel.SetViewModel(scaleVM);
            chartScalePanel.SetViewModel(scaleVM);

            core.SetupVisualizer(new List <IRLVPanel>
            {
                detailsControl,
                progressionChartControl,
                chartScalePanel,
                detailsScalePanel
            }, visualizer);
        }
コード例 #6
0
        public VisualizerWindow(IRLVCore core, IRLVOutputVisualizer visualizer)
        {
            InitializeComponent();

            this.core       = core;
            this.visualizer = visualizer;

            IRLVScaleSelectionVM scaleVM = new RLVScaleSelectionVM();

            detailsScalePanel = rlv.DetailsControl.ScalePanel;
            chartScalePanel   = rlv.ChartControl.ScalePanel;

            detailsScalePanel.SetViewModel(scaleVM);
            chartScalePanel.SetViewModel(scaleVM);
            scaleVM.DefaultScale = 100;

            core.SetupVisualizer(new List <IRLVPanel>
            {
                rlv.DetailsControl,
                rlv.ChartControl,
                chartScalePanel,
                detailsScalePanel
            }, visualizer);
        }
コード例 #7
0
        private void startOptimizing()
        {
            trainingOverlay.Visibility = Visibility.Visible;
            selectedSlotIndex          = -1;
            _row    = -1;
            _col    = -1;
            itemRow = -1;
            itemCol = 1;

            SimulationPanel simPanel = new SimulationPanel(mock);

            simPanel.SetSimSettings(simSettings);
            //bool? result = simPanel.ShowDialog();

            simPanel.btnRun_Click(null, null);

            //if (result.HasValue && result.Value == true)
            {
                // resets grid to default
                FillGrid(gridIceCreamShelves, Colors.LightGray);
                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;

                txtTargetScore.Text = "";
                if (simSettings.SimType == SimulationType.Score)
                {
                    txtTargetScore.Text = simSettings.Score.Value.ToString("n");
                }
                else
                {
                    txtTargetScore.Visibility = Visibility.Hidden;
                }

                //if (simSettings.SimType == SimulationType.Sessions)
                //{
                //    lblSessionPerBatch.Visibility = Visibility.Hidden;
                //    txtSessionPerBatch.Visibility = Visibility.Hidden;
                //}
                //else
                //{
                //    lblSessionPerBatch.Visibility = Visibility.Visible;
                //    txtSessionPerBatch.Visibility = Visibility.Visible;
                //}


                string dbIdentifier = "RLM_planogram_" + Guid.NewGuid().ToString("N");
                // instantiate visualizer with this window as its parent reference
                visualizer = new RLVOutputVisualizer(this);
                rlmDbData  = new RlmDbDataSQLServer(dbIdentifier);
                //rlmDbData = new RlmDbDataPostgreSqlServer(dbIdentifier);
                core = new RLVCore(rlmDbData);

                // 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 VisualizerWindow(core, visualizer);
                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);
                    }

                    // initialize and start RLM training
                    optimizer = new PlanogramOptimizer(items, simSettings, this.UpdateRLMResults, this.UpdateRLMStatus, Logger, dbIdentifier, OnRLMDataPersistProgress);
                    //optimizer.OnSessionDone += Optimizer_OnSessionDone;
                    optimizer.StartOptimization();
                });
            }
        }
コード例 #8
0
        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);
                });
            }
        }