public static void AddWorkStations(ToyFab toyFab, ToyFabSettings toyFabSettings, Simulation sim) { // Observers LotOutObserver LotOutObserver = new LotOutObserver(sim, "LotOutObserver"); RewardObserver RewardObserver = new RewardObserver(sim, "RewardObserver", Program.WSWithRLDispatcher); toyFab.Subscribe(RewardObserver); // Work stations foreach (string wc in toyFabSettings.WorkStations) { WorkStation workStation = new WorkStation(toyFab, $"WorkCenter_{wc}", toyFabSettings.LotStepsPerWorkStation[wc]); workStation.DispatcherWarmUp = new FIFODispatcher(workStation, workStation.Name + "_FIFODispatcher"); workStation.Dispatcher = new FIFODispatcher(workStation, workStation.Name + "_FIFODispatcher"); QueueObserver queueObserver = new QueueObserver(sim, $"Queue_{wc}"); workStation.Subscribe(queueObserver); // Machines foreach (MachineData m in toyFabSettings.Machines.Where(x => x.WorkStation == wc)) { Machine machine = new Machine(toyFab, $"{workStation.Name}_Machine{m.Number}", new GammaDistribution(m.MeanServiceTime, Math.Pow(m.COVServiceTime * m.MeanServiceTime, 2)), workStation, m.Number); //Machine machine = new Machine(toyFab, $"{workStation.Name}_Machine{m.Number}", new NonNegativeNormalDistribution(m.MeanServiceTime, m.COVServiceTime * m.MeanServiceTime), workStation, m.Number); //Machine machine = new Machine(toyFab, $"{workStation.Name}_Machine{m.Number}", new ExponentialDistribution(1 / m.MeanServiceTime), workStation, m.Number); machine.Eligibilities = m.Eligibilities; machine.Subscribe(LotOutObserver); workStation.Machines.Add(machine); } toyFab.AddWorkCenter(workStation.Name, workStation); } }
protected override void OnReplicationEnd(ModelElementBase modelElement) { ToyFab toyFab = (ToyFab)modelElement; replicationReward += toyFab.Reward.GetFinalReward(); Reward.Collect(replicationReward); }
public static void RunNormalSimulation() { string inputDir = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\", "Parameters", ParametersDirectory)); string outputDir = @"C:\CSSLWaferFab\Output\RLToyFab\"; CSSL.Modeling.Settings.WriteOutput = true; // Fab settings //IDataReader reader = new DataReader1(inputDir); IDataReader reader = new DataReader2(inputDir); ToyFabSettings toyFabSettings = reader.ReadToyFabSettings(); // Build Fab Simulation sim = new Simulation("RLToyFab", outputDir); // Experiment settings sim.MyExperiment.NumberOfReplications = 10; sim.MyExperiment.LengthOfWarmUp = LengthOfWarmUp; sim.MyExperiment.LengthOfReplication = LengthOfReplication; // Build the model ToyFab toyFab = new ToyFab(sim.MyModel, "WaferFab") { LotSteps = toyFabSettings.LotSteps, LengthOfWarmUp = LengthOfWarmUp }; AddWorkStations(toyFab, toyFabSettings, sim); foreach (var sequence in toyFabSettings.Sequences) { toyFab.AddSequence(sequence.Key, sequence.Value); } toyFab.SetLotGenerator(new LotGenerator(toyFab, "LotGenerator", NumberOfLots)); sim.Run(); // Report summary SimulationReporter reporter = sim.MakeSimulationReporter(); reporter.PrintSummaryToFile(); reporter.PrintSummaryToConsole(); }
public RewardODDScaled(ToyFab toyFab) : base(toyFab, "RewardODDScaled") { this.toyFab = toyFab; }
public RewardThroughputTardiness(ToyFab toyFab, double weight = 1) : base(toyFab, "RewardThroughputTardiness") { this.toyFab = toyFab; DepartedLots = new List <Lot>(); Weight = weight; }
protected override void OnInitialized(ModelElementBase modelElement) { ToyFab toyFab = (ToyFab)modelElement; toyFab.Reward.Initialize(); }
protected override void OnUpdate(ModelElementBase modelElement) { ToyFab toyFab = (ToyFab)modelElement; replicationReward += toyFab.Reward.GetReward(); }
public RewardODD(ToyFab toyFab) : base(toyFab, "RewardODD") { this.toyFab = toyFab; }
public StateDeductedActionSpace(ToyFab toyFab, int JobCountInAction) { this.toyFab = toyFab; FullState = new double[7][]; this.JobCountInAction = JobCountInAction; }
public RewardThroughput(ToyFab toyFab, int weight = 1) : base(toyFab, "RewardThroughput") { this.toyFab = toyFab; DepartedLots = new List <Lot>(); Weight = weight; }
public RewardODDScaledSingle(ToyFab toyFab) : base(toyFab, "RewardODDScaledSingle") { this.toyFab = toyFab; }
public State(ToyFab toyFab) { this.toyFab = toyFab; FullState = new double[6][]; }