public RlmOptimizer(IRlmDbData rlmDbData, IRlmRneuronProcessor gpu = null) { Resources = new Dictionary <string, Resource>(); ResourceAttributes = new Dictionary <string, ResourceAttribute>(); Constraints = new Dictionary <string, Constraint>(); CycleOutputs = new Dictionary <string, object>(); SessionOutputs = new Dictionary <string, List <object> >(); CycleInputs = new Dictionary <string, object>(); TrainingVariables.Add("CycleScore", new TrainingVariable() { Name = "CycleScore" }); TrainingVariables.Add("SessionScore", new TrainingVariable() { Name = "SessionScore" }); //if (!string.IsNullOrEmpty(databaseName)) //{ // DatabaseName = databaseName; //} RlmDbData = rlmDbData; DatabaseName = rlmDbData.DatabaseName; if (gpu != null) { Gpu = gpu; } }
private void btnVisualizer_Click(object sender, RoutedEventArgs e) { //rlmDbData = new RlmDbDataPostgreSqlServer(dbIdentifier); rlmDbData = new RlmDbDataSQLServer(dbIdentifier); core = new RLVCore(rlmDbData); rlvPanel = new VisualizerWindow(core, challenger.HighestMoveCount, challenger.RecentMoves); rlvPanel.Show(); }
/// <summary> /// sets your preferred database name /// </summary> /// <param name="databaseName">Uses a custom database name instead of the default generated name</param> /// <param name="persistData">Allows you to turn on/off the data persistence feature of the RLM. Turned on by default.</param> public RlmNetwork(IRlmDbData rlmDbData, bool persistData = true, IRlmRneuronProcessor gpu = null) { PersistData = persistData; this.RlmDBData = rlmDbData; DatabaseName = rlmDbData.DatabaseName; rlmDbData.Initialize(); SessionCaseHistory = new RlmSessionCaseHistory(rlmDbData); Initialize(gpu); }
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); rlmDbData = new RlmDbDataSQLServer(dbIdentifier); //rlmDbData = new RlmDbDataPostgreSqlServer(dbIdentifier); core = new RLVCore(rlmDbData); this.Top = 20; rlvPanel = new VisualizerWindow(core, visualizer); }
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(); }); } }
public RlmNetworkLegacy(IRlmDbData rlmDbData, bool persistData = true) : base(rlmDbData, persistData) { rlmDbDataLegacy = rlmDbData; }
public RlmNetworkWebAPI(IRlmDbData rlmDbData) : base(rlmDbData) { }
public RlmSessionCaseHistory(IRlmDbData rlmDb) { this.rlmDb = rlmDb; rlmDb.Initialize(); DatabaseName = rlmDb.DatabaseName; }
public RLVCore(IRlmDbData rlmDb) { rlmDb.Initialize(); rlmHistory = new RlmSessionCaseHistory(rlmDb); }
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); rlmDbData = new RlmDbDataSQLServer(dbIdentifier); //rlmDbData = new RlmDbDataPostgreSqlServer(dbIdentifier); core = new RLVCore(rlmDbData); // 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, tokenSource.Token); 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); }); } }