static SimulationResult SimulateRun(RealProductionSimulator productionSimulator) { var result = new SimulationResult(); productionSimulator.Controller.RealTime = -300; var plannedRealProcessingTime = GetPlanedTime(productionSimulator.Controller.ProductionState.FutureProductionPlan.Count); while (productionSimulator.Controller.ProductionState.FutureProductionPlan.Count > 0) { productionSimulator.NextStep(); //Console.WriteLine(productionSimulator.Controller.StepLog.Last()); //Console.WriteLine($"{productionSimulator.Controller.RealTime}; {productionSimulator.Controller.Delay}; {productionSimulator.Controller.ProductionState.FutureProductionPlan.Count}"); if (productionSimulator.Controller.Delay > 0 && result.FirstDelayProductionPlanCount == 0) { result.FirstDelayProductionPlanCount = productionSimulator.Controller.ProductionState.FutureProductionPlan.Count; } if (productionSimulator.Controller.RealTime <= plannedRealProcessingTime) { result.PlannedTimeProductionPlanCount = productionSimulator.Controller.ProductionState.FutureProductionPlan.Count; } } // problem with last step of async controller bool missingGet = productionSimulator.Controller.ProductionState.ProductionHistory.Count > 64; // TODO: add constant result.DelayTime = productionSimulator.Controller.Delay; return(result); }
static void Main(string[] args) { string startupPath = Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName; NaiveController naiveController = new NaiveController(new ProductionState(), Path.Combine(startupPath, @"OptimizationLogic\InputFiles\ProcessingTimeMatrix.csv"), Path.Combine(startupPath, @"OptimizationLogic\InputFiles\situation1\WarehouseInitialState.csv"), Path.Combine(startupPath, @"OptimizationLogic\InputFiles\situation1\HistoricalProductionList.txt"), Path.Combine(startupPath, @"OptimizationLogic\InputFiles\situation1\FutureProductionList.txt")); GreedyWarehouseReorganizer warehouseReorganizer = new GreedyWarehouseReorganizer(maxDepth: 10, selectBestCnt: 1); RealProductionSimulator productionSimulator = new RealProductionSimulator(naiveController, warehouseReorganizer); productionSimulator.Run(); }
public MainWindow() { InitializeComponent(); var productionState = new ProductionState(); var scenarioLoader = new ProductionStateLoader(LoadScenarionPaths("InputFiles"), "InputFiles/ProcessingTimeMatrix.csv"); var naiveController = new NaiveController(productionState); BaseController asyncController = new NaiveAsyncControllerWithHalfCycleDelay(productionState); GreedyWarehouseReorganizer reorganizer = new GreedyWarehouseReorganizer(); RealProductionSimulator realProductionSimulator = new RealProductionSimulator(naiveController, null); //ViewModel = new MainWindowViewModel(naiveController, scenarioLoader); var openFileDialog = new OpenFileDialogService(); IOpenFileService openFolderDialog = new OpenFolderDialogService(); ViewModel = new MainWindowViewModel(naiveController, asyncController, reorganizer, realProductionSimulator, scenarioLoader, openFileDialog, openFolderDialog, DialogCoordinator.Instance); DataContext = ViewModel; }
static Dictionary <string, RealProductionSimulator> GetSimulationsDict(string key, string matrixFilename, string warehouseFilename, string historyFilename, string planFilename) { Dictionary <string, RealProductionSimulator> simulationsDict = new Dictionary <string, RealProductionSimulator>(); simulationsDict[$"naive-skip_break-{key}"] = new RealProductionSimulator( new NaiveController(new ProductionState(), matrixFilename, warehouseFilename, historyFilename, planFilename) ); simulationsDict[$"naive-reorganization-{key}"] = new RealProductionSimulator( new NaiveController(new ProductionState(), matrixFilename, warehouseFilename, historyFilename, planFilename), new GreedyWarehouseReorganizer(maxDepth: 10, selectBestCnt: 1) ); simulationsDict[$"async-skip_break-{key}"] = new RealProductionSimulator( new NaiveAsyncControllerWithHalfCycleDelay(new ProductionState(), matrixFilename, warehouseFilename, historyFilename, planFilename) ); simulationsDict[$"async-reorganization-{key}"] = new RealProductionSimulator( new NaiveAsyncControllerWithHalfCycleDelay(new ProductionState(), matrixFilename, warehouseFilename, historyFilename, planFilename), new GreedyWarehouseReorganizer(maxDepth: 10, selectBestCnt: 1) ); return(simulationsDict); }