Ejemplo n.º 1
0
        protected override void OnExperimentStart()
        {
            // Initialize RL state
            Lots         = new Lot[LotGenerator.TargetWIP];
            Machines     = new Machine[WorkStations.Values.SelectMany(x => x.Machines).Count()];
            ProductTypes = new string[Sequences.Count()];
            MachineIndexes.Clear();
            ProductTypeIndexes.Clear();

            int machineIndex = 0;

            foreach (Machine machine in WorkStations.Values.SelectMany(x => x.Machines).OrderBy(x => x.Index))
            {
                Machines[machineIndex] = machine;
                MachineIndexes.Add(machine, machineIndex);
                machineIndex++;
            }

            int ptIndex = 0;

            foreach (string type in Sequences.Keys.OrderBy(x => x))
            {
                ProductTypes[ptIndex] = type;
                ProductTypeIndexes.Add(type, ptIndex);
                ptIndex++;
            }

            State.Initialize();

            // Initialize TargetCycleTimesPerStep in Sequences
            foreach (Sequence seq in Sequences.Values)
            {
                seq.CalculateTargetCycleTimesPerStep();
            }
        }