Permalink
Browse files

Data Generation Process now included when you start simulation. Added…

… Progress Bar at the bottom of the application.

Planogram Size renamed to Difficulty Level.
Changing Difficulty Level will no longer immediately require overwriting of current test data. This will be done once the training started.
Added Tooltips to help users in starting a training.
Download link for retail data is now accessible on main page once training is available.
  • Loading branch information...
ginomortillero committed Nov 16, 2017
1 parent f1b9d8f commit 7e0601c5a39ff32c36bfd8b1637dd09b9b1c9471
Showing with 561 additions and 419 deletions.
  1. BIN ExampleApps/CSharp/RetailPoC 2.0/Installers/RetailPoCIBMSetup.msi
  2. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/App.xaml
  3. +4 −4 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/App.xaml.cs
  4. +3 −3 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/DataGeneration/DataFactory.cs
  5. +13 −9 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/DataGeneration/MockData.cs
  6. +3 −3 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/DataPanel.xaml
  7. +33 −41 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/DataPanel.xaml.cs
  8. +3 −3 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/EngineTrainingWindow.xaml
  9. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/EngineTrainingWindow.xaml.cs
  10. BIN ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Img/Flowchart.png
  11. BIN ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Img/Flowchart2.png
  12. BIN ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Img/callout.png
  13. BIN ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Img/calloutreverse.png
  14. BIN ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Img/xCircle.png
  15. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/ItemAttributesPanel.xaml
  16. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/ItemAttributesPanel.xaml.cs
  17. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/ItemClickedCommand.cs
  18. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/ItemComparisonPanel.xaml
  19. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/ItemComparisonPanel.xaml.cs
  20. +55 −33 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/MainWindow.xaml
  21. +298 −247 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/MainWindow.xaml.cs
  22. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/MetricPanel.xaml
  23. +3 −3 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/MetricPanel.xaml.cs
  24. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/Attributes.cs
  25. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/Item.cs
  26. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/PlanogramContext.cs
  27. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/PlanogramOptResults.cs
  28. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/PlanogramOptResultsSettings.cs
  29. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/PlanogramSize.cs
  30. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/RPOCSimulationSettings.cs
  31. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/RetailData.cs
  32. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/Scale.cs
  33. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/Shelf.cs
  34. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/ShelfItem.cs
  35. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Models/SimulationData.cs
  36. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/NoDataNotificationWindow.xaml
  37. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/NoDataNotificationWindow.xaml.cs
  38. +10 −4 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/PlanogramOptimizer.cs
  39. +29 −7 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/PlanogramOptimizerEncog.cs
  40. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Properties/Resources.Designer.cs
  41. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/Properties/Settings.Designer.cs
  42. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/RLVOutputVisualizer.cs
  43. +8 −10 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/RetailPoC20.csproj
  44. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/SimulationCsvLogger.cs
  45. +43 −0 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/SimulationSetter.cs
  46. +6 −3 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/StartupWindow.xaml
  47. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/StartupWindow.xaml.cs
  48. +2 −2 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/TempRLVContainerPanel.xaml
  49. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/TempRLVContainerPanel.xaml.cs
  50. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/ViewModels/AttributesVM.cs
  51. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/ViewModels/ItemVM.cs
  52. +1 −1 ExampleApps/CSharp/RetailPoC 2.0/RetailPoC20/ViewModels/MetricVM.cs
  53. +3 −3 ExampleApps/CompetitorComparableApps/RetailPoC 2.0/RetailPoC20_Tensorflow/Headtohead.py
  54. +2 −2 ExampleApps/CompetitorComparableApps/RetailPoC 2.0/RetailPoC20_Tensorflow/PlanogramOptTensorflow.py
  55. +1 −1 ExampleApps/CompetitorComparableApps/RetailPoC 2.0/RetailPoC20_Tensorflow/RetailPoC20.pyproj
  56. +1 −0 RLM.sln
@@ -1,7 +1,7 @@
<Application x:Class="RetailPoC.App"
<Application x:Class="RetailPoC20.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:RetailPoC"
xmlns:local="clr-namespace:RetailPoC20"
Startup="Application_Startup">
<Application.Resources>
@@ -8,7 +8,7 @@
using System.Windows.Media;
using System.Windows.Navigation;
namespace RetailPoC
namespace RetailPoC20
{
/// <summary>
/// Interaction logic for App.xaml
@@ -22,14 +22,14 @@ protected override void OnStartup(StartupEventArgs e)
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/Orange.xaml") });
this.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml") });
this.Resources.Add(new FontFamily("OswaldBold"), "/RetailPoC;component/Fonts/Oswald-Bold.ttf");
this.Resources.Add(new FontFamily("OswaldLight"), "/RetailPoC;component/Fonts/Oswald-Light.ttf");
this.Resources.Add(new FontFamily("OswaldBold"), "/RetailPoC20;component/Fonts/Oswald-Bold.ttf");
this.Resources.Add(new FontFamily("OswaldLight"), "/RetailPoC20;component/Fonts/Oswald-Light.ttf");
base.OnStartup(e);
}
private void Application_Startup(object sender, StartupEventArgs e)
{
RetailPoC.MainWindow main = new RetailPoC.MainWindow();
RetailPoC20.MainWindow main = new RetailPoC20.MainWindow();
MainWindow = main;
main.Show();
}
@@ -1,5 +1,5 @@
using RetailPoC.Models;
using RetailPoC.ViewModels;
using RetailPoC20.Models;
using RetailPoC20.ViewModels;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -9,7 +9,7 @@
using System.Text;
using System.Threading.Tasks;
namespace RetailPoC
namespace RetailPoC20
{
public class DataFactory
{
@@ -1,4 +1,4 @@
using RetailPoC.Models;
using RetailPoC20.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
@@ -10,7 +10,7 @@
using CsvHelper;
using Microsoft.Win32;
namespace RetailPoC
namespace RetailPoC20
{
public class MockData : IDisposable
{
@@ -21,7 +21,7 @@ public class MockData : IDisposable
public delegate void dataPanelProgress(double value);
public delegate void dataPanelGrid(bool refresh);
public event dataPanelProgress Progress;
public event GeneratingData GeneratingDataEvent;
public event dataPanelGrid Refreshdata;
public MockData()
@@ -42,7 +42,7 @@ public MockData(PlanogramContext context)
rnd = new Random();
}
public double GetItemMinimumScore(RPOCSimulationSettings simSettings)
{
double retVal = double.MinValue;
@@ -196,11 +196,13 @@ public async Task Generate(int numItems=5000)
//update progress
var currentProgress = ((currentRows / _attributes.Count()) * 100);
Progress(currentProgress);
GeneratingDataEvent?.Invoke(currentProgress, "Generating historical metric data...", false);
await _context.SaveChangesAsync();
}
GeneratingDataEvent?.Invoke(100, "Generating historical metric data...", false);
//_context.ItemAttributes.AddRange(_attributes);
//_context.SaveChangesAsync();
@@ -229,15 +231,15 @@ public async Task Generate(int numItems=5000)
SKU = String.Format("{0:0000}", i),
Attributes = _attributes.Where(x => numbers.Any(a => a == x.ID)).ToList(),
Color = color.ToArgb() //converts the color to integer to be save in the database
};
};
_items.Add(item);
//System.Diagnostics.Debug.WriteLine($"Item {i}");
}
currentRows = 0;
Progress(0);
GeneratingDataEvent?.Invoke(0, "Generating random products...", false);
while (currentRows < _items.Count())
{
currentRows = _context.Items.Count();
@@ -246,15 +248,17 @@ public async Task Generate(int numItems=5000)
//update progress
var currentProgress = ((currentRows / _items.Count()) * 100);
Progress(currentProgress);
GeneratingDataEvent?.Invoke(currentProgress, "Generating random products...", false);
await _context.SaveChangesAsync();
}
GeneratingDataEvent?.Invoke(100, "Generating random products...", true);
//_context.Items.AddRange(_items);
//_context.SaveChangesAsync();
Refreshdata(true);
//Refreshdata(true);
}
public int GetItemsCount()
@@ -1,9 +1,9 @@
<Controls:MetroWindow x:Class="RetailPoC.DataPanel"
<Controls:MetroWindow x:Class="RetailPoC20.DataPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:RetailPoC"
xmlns:local="clr-namespace:RetailPoC20"
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
@@ -20,7 +20,7 @@
<Grid>
<DataGrid x:Name="dataGrid" Margin="10,58" ColumnWidth="Auto" SelectionMode="Single" ScrollViewer.CanContentScroll="True" MouseDoubleClick="dataGrid_MouseDoubleClick" BorderBrush="LightGray" BorderThickness="1" />
<Grid Height="38" Margin="10,10,10,0" VerticalAlignment="Top">
<Button x:Name="generateDataBtn" Content="Generate Data" HorizontalAlignment="Left" VerticalAlignment="Top" Width="114" Click="generateDataBtn_Click" Foreground="#FFFFFF" FontFamily="Fonts/#Oswald Light" FontSize="14" BorderBrush="#FFFE8F41" Background="#FFFE8F41" Height="35"/>
<Button x:Name="generateDataBtn" Content="Generate Data" HorizontalAlignment="Left" VerticalAlignment="Top" Width="114" Click="GenerateDataBtn_Click" Foreground="#FFFFFF" FontFamily="Fonts/#Oswald Light" FontSize="14" BorderBrush="#FFFE8F41" Background="#FFFE8F41" Height="35"/>
<Grid Height="38" Margin="0,0,-9,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="263">
<TextBox x:Name="searchItemBox" Height="23" Margin="60,5,10,0" TextWrapping="Wrap" VerticalAlignment="Top" KeyUp="textBox_KeyUp"/>
<Label x:Name="label" Content="Search:&#xD;&#xA;" HorizontalAlignment="Left" Margin="7,5,0,0" VerticalAlignment="Top" Width="48" Height="23"/>
@@ -1,5 +1,5 @@
using RetailPoC.Models;
using RetailPoC.ViewModels;
using RetailPoC20.Models;
using RetailPoC20.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -15,9 +15,10 @@
using System.Windows.Shapes;
using MahApps.Metro.Controls;
namespace RetailPoC
namespace RetailPoC20
{
public delegate void GeneratingData(string value);
public delegate void GeneratingData(double percent, string text, bool isDone, Exception ex = null);
/// <summary>
/// Interaction logic for DataPanel.xaml
/// </summary>
@@ -49,61 +50,52 @@ private void textBox_KeyUp(object sender, KeyEventArgs e)
}
}
private async void generateDataBtn_Click(object sender, RoutedEventArgs e)
public async void GenerateDataBtn_Click(object sender, RoutedEventArgs e)
{
using (PlanogramContext context = new PlanogramContext())
{
MockData data = new MockData(context);
data.NumItems = this.NumItems;
GenerateDataEvent?.Invoke(0, "Preparing data generation...", false);
generateDataBtn.IsEnabled = false;
DataProgressBar.Visibility = Visibility.Visible;
//todo: ask for confirmation
if (context.Items.Count() > 0)
try
{
using (PlanogramContext context = new PlanogramContext())
{
var confirmation = MessageBox.Show("Warning! You currently have an existing database. Generating a new set of data will overwrite the current one. Proceed?", "Confirmation", MessageBoxButton.OKCancel, MessageBoxImage.Question);
//var confirmation = MessageBox.Show("Warning! You currently have an existing database. Generating a new set of data will overwrite the current one. Proceed?", "Confirmation", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (confirmation == MessageBoxResult.OK)
int dataCount = context.Items.Count();
if (dataCount == this.NumItems)
{
GenerateDataEvent?.Invoke(100, "", true);
}
else
{
//todo: dropDb and generate a new data set
context.Database.Delete();
context.Database.CreateIfNotExists();
this.dataGrid.ItemsSource = dataFactory.Items;
this.Items = dataFactory.Items;
MockData data = new MockData(context);
data.NumItems = this.NumItems;
//generateDataBtn.IsEnabled = false;
//DataProgressBar.Visibility = Visibility.Visible;
data.GeneratingDataEvent += (p, t, d, ex) =>
{
GenerateDataEvent?.Invoke(p, t, d, ex);
};
data.Progress += dataPanelProgress;
data.Refreshdata += refreshDataGrid;
GenerateDataEvent?.Invoke("Generating sample retail data...");
//data.Refreshdata += refreshDataGrid;
await data.Generate();
}
else
{
generateDataBtn.IsEnabled = true;
DataProgressBar.Visibility = Visibility.Hidden;
}
}
else
{
data.Progress += dataPanelProgress;
data.Refreshdata += refreshDataGrid;
GenerateDataEvent?.Invoke("Generating sample retail data...");
await data.Generate();
}
}
catch (Exception ex)
{
GenerateDataEvent?.Invoke(0, "An error occured. Please click here to view the full details.", true, ex);
}
}
private void refreshBtn_Click(object sender, RoutedEventArgs e)
{
// Re-query from the database the list of items and store it to local variables
refreshDataGrid(true);
}
void dataPanelProgress(double value)
{
DataProgressBar.Value = value;
}
void refreshDataGrid(bool refresh)
{
@@ -114,7 +106,7 @@ void refreshDataGrid(bool refresh)
generateDataBtn.IsEnabled = true;
DataProgressBar.Value = 0;
DataProgressBar.Visibility = Visibility.Hidden;
GenerateDataEvent?.Invoke("Done.");
//GenerateDataEvent?.Invoke("Done.");
}
}
@@ -1,12 +1,12 @@
<Controls:MetroWindow x:Class="RetailPoC.EngineTrainingWindow"
<Controls:MetroWindow x:Class="RetailPoC20.EngineTrainingWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:RetailPoC"
xmlns:local="clr-namespace:RetailPoC20"
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
Title="Shelve Space Layout" Closing="Window_Closing" LocationChanged="MetroWindow_LocationChanged" Width="728.034" Height="419.385" BorderBrush="LightGray" BorderThickness="0.6">
Title="Shelf Space Layout" Closing="Window_Closing" LocationChanged="MetroWindow_LocationChanged" Width="728.034" Height="419.385" BorderBrush="LightGray" BorderThickness="0.6">
<Controls:MetroWindow.Resources>
<SolidColorBrush x:Key="comparisonBlack" Color="Black" Opacity="0.8"></SolidColorBrush>
</Controls:MetroWindow.Resources>
@@ -1,4 +1,4 @@
using RetailPoC.Models;
using RetailPoC20.Models;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -13,7 +13,7 @@
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace RetailPoC
namespace RetailPoC20
{
/// <summary>
/// Interaction logic for EngineTrainingWindow.xaml
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,9 @@
<Controls:MetroWindow x:Class="RetailPoC.ItemAttributesPanel"
<Controls:MetroWindow x:Class="RetailPoC20.ItemAttributesPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:RetailPoC"
xmlns:local="clr-namespace:RetailPoC20"
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
Title="ItemAttributes" Height="337.029" Width="362.133" Topmost="True" WindowStartupLocation="CenterScreen" SizeToContent="Height" FontFamily="Fonts/#Oswald Light">
@@ -13,7 +13,7 @@
using System.Windows.Shapes;
using MahApps.Metro.Controls;
namespace RetailPoC
namespace RetailPoC20
{
/// <summary>
/// Interaction logic for ItemAttributes.xaml
@@ -5,7 +5,7 @@
using System.Threading.Tasks;
using System.Windows.Input;
namespace RetailPoC
namespace RetailPoC20
{
public class ItemClickedCommand : ICommand
{
@@ -1,9 +1,9 @@
<Controls:MetroWindow x:Class="RetailPoC.ItemComparisonPanel"
<Controls:MetroWindow x:Class="RetailPoC20.ItemComparisonPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:RetailPoC"
xmlns:local="clr-namespace:RetailPoC20"
ShowCloseButton="False"
ShowTitleBar="False"
mc:Ignorable="d"
@@ -1,4 +1,4 @@
using RetailPoC.Models;
using RetailPoC20.Models;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -13,7 +13,7 @@
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace RetailPoC
namespace RetailPoC20
{
/// <summary>
/// Interaction logic for ItemComparisonPanel.xaml
Oops, something went wrong.

0 comments on commit 7e0601c

Please sign in to comment.