public override void AlwaysPushing(UnitloadList currentListIn) { foreach (Unitload unit in currentListIn) { Processor ProcessorToRelease = (Processor)unit.Location; if (unit.Station.InQueue.IsAvailable == false) { this.Manager.JobManager.BlockedUnitloads.Add(unit); ProcessorToRelease.ChangeBlocked(this.Manager.Time, true); } //block else { //double transferTime = this.Manager.LayoutManager.Layout.DistanceMatrix[(Station)ProcessorToRelease.Parent, unit.Station]; double transferTime = 1; unit.Station.InQueue.Reserved++; unit.InTransfer = true; this.Manager.LayoutManager.Layout.UnitloadsOnMover.Add(unit); ProcessorToRelease.Release(this.Manager.Time, unit); //operation and processor will be selected when the unitload is in inqueue of its station. this.Manager.TriggerStationControllerAlgorithm((Station)ProcessorToRelease.Parent); this.Manager.EventCalendar.ScheduleEnterQueueEvent(this.Manager.Time + transferTime, unit.Station.InQueue, unit); } //go } currentListIn.Clear(); }
public override Event GetEvent(SimulationManager managerIn) { StationList processCells = managerIn.LayoutManager.Layout.Stations; UnitloadList unitloads = managerIn.JobManager.Unitloads; return(new StartProcessEvent(this.Time, managerIn, processCells[this.cell].Processors[this.processor], unitloads[this.unitload], this.transferTime)); }
public void StarvationUpdate(UnitloadList unitloadstogo, double timeIn) //IE486 Fall18 { int countAvailable = 0, countBlocked = 0; bool anyProcessorIsStarved = false; //starvation update for the processors foreach (Processor p in this.processors) { bool starved = false; //not starved at first if (p.IsAvailable == true) { countAvailable++; foreach (Unitload unit in unitloadstogo) { foreach (JobRoute currentRoute in unit.Alternates) { Operation operation = currentRoute.Operations[unit.Completed.Count]; if (p.Operations.Contains(operation)) //there is a job in inqueue that p can process but cannot take it { starved = true; anyProcessorIsStarved = true; break; } } if (starved == true) { break; } // no need to check other unitloads in unitloadstogo } } else { if (p.IsBlocked == true) { countBlocked++; } } if (p.IsStarved != starved) { p.ChangeStarved(timeIn, starved); } } // starvation update for the station if ((countBlocked + countAvailable == this.processors.Count) && anyProcessorIsStarved) { if (this.IsStarved != true) { this.ChangeStarved(timeIn, true); } } else { if (this.IsStarved != false) { this.ChangeStarved(timeIn, false); } } }
public void Execute() { UnitloadList currentList = this.Manager.JobManager.UnitloadsToPush; this.PreOperation(); this.AlwaysPushing(currentList); this.PostOperation(); }
public void Execute() { this.PreOperation(); StationList inputStations = this.FindCandidateCells(); foreach (Station inputStation in inputStations) { UnitloadList unitloads = inputStation.FindUnreleasedUnitloads(); UnitloadList selectedUnitloads = this.SelectUnitloads(inputStation, unitloads); this.PostOperation(inputStation, selectedUnitloads, names); } }
private UnitloadList blockedUnitloads; //state ie486f18 public JobManager(string nameIn, FLOWObject parentIn) : base(nameIn, parentIn) { this.batchSizeList = new IntegerList(); this.dueDateList = new DoubleList(); this.jobs = new JobList(); this.unitloads = new UnitloadList(); this.unitloadsToDecide = new UnitloadList(); this.unitloadsToRoute = new UnitloadList(); this.unitloadsToPush = new UnitloadList(); this.blockedUnitloads = new UnitloadList(); }
//this function is for just inputstations(copied from inputcell functions after deleting inputcell) public UnitloadList FindUnreleasedUnitloads() { UnitloadList unitloads = new UnitloadList(); foreach (Unitload unitload in this.InQueue.Content) { if (unitload.InTransfer == false) { unitloads.Add(unitload); } } return(unitloads); }
public UnitloadList Execute(UnitloadList unitloadsIn) { UnitloadList Unitloads = new UnitloadList(); this.PreOperation(); if (unitloadsIn.Count != 0) { Unitloads = this.UnitloadListSelection(unitloadsIn); } this.Prioritize(unitloadsIn); this.PostOperation(); return(Unitloads); }
private Transporter transporter; // bypass için şimdilik bir tane uncapacitated transporter yaratıldı. IE486 public Layout() { this.bufferCells = new BufferCellList(); this.inputStations = new StationList(); this.nodes = new NodeList(); this.operations = new OperationList(); this.outputStations = new StationList(); this.stations = new StationList(); this.bins = new BinList(); this.componentTypes = new ComponentTypeList(); this.unitloadsonMover = new UnitloadList(); this.transporter = new Transporter(); }
protected override void PostOperation(Station inputStationIn, UnitloadList selectedUnitloadsIn, System.Collections.ArrayList names) { this.Manager.JobManager.UnitloadsToDecide.AddRange(selectedUnitloadsIn); this.Manager.Algorithms.OperationSelection.Execute(); foreach (Unitload unitload in selectedUnitloadsIn) { if (unitload.Station.InQueue.IsAvailable == true) { unitload.InTransfer = true; unitload.Station.InQueue.Reserved++; double releaseTime = 0; } } }
protected override void PostOperation(Station inputStationIn, UnitloadList selectedUnitloadsIn, System.Collections.ArrayList names) { foreach (Unitload unitload in selectedUnitloadsIn) { unitload.InTransfer = true; double transferTime = this.Manager.Time + inputStationIn.TransferTime.GenerateValue(); Job job = (Job)unitload.Parent; names.Add(job.Name); if (job.StartTime == Double.PositiveInfinity) { job.StartTime = this.Manager.Time; } } }
protected override UnitloadList UnitloadListSelection(UnitloadList unitloads) { UnitloadList unitloadsinQueue = new UnitloadList(); UnitloadList consideredunitloads = new UnitloadList(); foreach (Unitload unit in unitloads) { if (unit.IsCompleted == false) { OperationList consideredOperations = new OperationList(); foreach (JobRoute currentRoute in unit.Alternates) { Operation operation = currentRoute.Operations[unit.Completed.Count]; if (consideredOperations.Contains(operation) == false && consideredunitloads.Contains(unit) == false) { //operation can be done in identical processors if (operation.Processor == null) { foreach (Processor processor in unit.Station.Processors) { if ((processor.IsAvailable == true) && (processor.Operations.Contains(operation))) { unitloadsinQueue.Add(unit); consideredOperations.Add(operation); consideredunitloads.Add(unit); break; } } } else //if the processor of the operation is determined from beginning (not identical) { if (operation.Processor.IsAvailable == true) { unitloadsinQueue.Add(unit); consideredOperations.Add(operation); consideredunitloads.Add(unit); break; } } } if (consideredunitloads.Contains(unit)) { break; } } } } return(unitloadsinQueue); }
public Layout(string nameIn, FLOWObject parentIn) : base(nameIn, parentIn) { this.bufferCells = new BufferCellList(); this.inputStations = new StationList(); this.nodes = new NodeList(); this.operations = new OperationList(); this.outputStations = new StationList(); this.stations = new StationList(); this.bins = new BinList(); this.componentTypes = new ComponentTypeList(); this.unitloadsonMover = new UnitloadList(); this.transporter = new Transporter(); this.onHandWriter = new TextOutput(((SimulationManager)parentIn.Parent).path); }
public void Execute() { UnitloadList unitloads = this.Manager.JobManager.UnitloadsToDecide; this.PreOperation(unitloads); foreach (Unitload unitload in unitloads) { OperationList operations = new OperationList(); StationList processCells = new StationList(); Station currentStation = unitload.Station; this.SelectOperation(unitload, operations, processCells); //IE486f18 } unitloads.Clear(); this.PostOperation(); }
public Job(string nameIn, FLOWObject parentIn, double arrivalTimeIn, int batchSizeIn, double dueDateIn, JobType jobTypeIn) : base(nameIn, parentIn) { this.arrivalTime = arrivalTimeIn; this.batchSize = batchSizeIn; this.dueDate = dueDateIn; this.jobType = jobTypeIn; this.startTime = Double.PositiveInfinity; this.completed = new UnitloadList(); this.unitloads = new UnitloadList(); for (int i = 1; i <= batchSizeIn; i++) { Unitload current = new Unitload(String.Format("{0}-Unitload{1}", nameIn, i), this); current.Alternates = jobTypeIn.Alternates.Clone(); this.unitloads.Add(current); } }
public override PullDecision PullUnitload(Queue queueIn, UnitloadList unitloadListIn) { PullDecision decision = new PullDecision(); //First blocked first served foreach (Unitload unit in unitloadListIn) { if (unit.Station.InQueue == queueIn) { decision.Unitload = unit; decision.InQueue = unit.Station.InQueue; return(decision); //first one added to blocked list is found, break } } return(null); }
protected override void ControlStation(FLOW.NET.Layout.Station stationIn) { UnitloadList uloadtogo = new UnitloadList(); if (stationIn.GetFreeProcessors().Count > 0) { if (stationIn.InQueue.Content != null) { foreach (Unitload u in stationIn.InQueue.Content) { uloadtogo.Add(u); } uloadtogo = this.Manager.Algorithms.PartSequencingForProcessor.Execute(uloadtogo); //FirstComeMustGo is an example foreach (Unitload unit in uloadtogo) { Processor selectedprocessor = null; if (unit.IsCompleted == false) { selectedprocessor = this.Manager.Algorithms.ProcessorSelection.Execute(unit); } if (selectedprocessor != null) { unit.InTransfer = true; double transferTime = stationIn.TransferTime.GenerateValue(); this.Manager.EventCalendar.ScheduleStartProcessEvent(this.Manager.Time, selectedprocessor, unit, transferTime); selectedprocessor.Reserved++; ((Station)selectedprocessor.Parent).BinMagazine.SpendComponent(unit.Operation.ComponentUsages); ((Station)selectedprocessor.Parent).BinMagazine.CheckComponentOrder(unit.Operation.ComponentUsages); } if (stationIn.GetFreeProcessors().Count == 0) { break; } } } } stationIn.BlockageUpdate(this.Manager.Time); stationIn.StarvationUpdate(uloadtogo, this.Manager.Time); }
//ProcessorSelectionAlgorithm public void Execute() { this.PreOperation(); QueueList queueList = this.Manager.LayoutManager.QueuesToPull; UnitloadList unitloadList = this.Manager.JobManager.BlockedUnitloads; foreach (Queue queue in queueList) { while (queue.IsAvailable == true) { PullDecision decision = this.PullUnitload(queue, unitloadList); if (decision == null) { break; } else { Processor ProcessorToRelease = ((Processor)decision.Unitload.Location); Unitload unitloadToGo = decision.Unitload; //int transferTime = this.Manager.LayoutManager.Layout.DistanceMatrix[(Station)ProcessorToRelease.Parent, unitloadToGo.Station]; ie486f18 int transferTime = 1; queue.Reserved++; unitloadToGo.InTransfer = true; this.Manager.LayoutManager.Layout.UnitloadsOnMover.Add(unitloadToGo); //geldiği processorün/inqueuecellin queusunun blockedı açılacak. (Release) ProcessorToRelease.Release(this.Manager.Time, unitloadToGo); ProcessorToRelease.ChangeBlocked(this.Manager.Time, false); this.Manager.TriggerStationControllerAlgorithm((Station)ProcessorToRelease.Parent); this.Manager.EventCalendar.ScheduleEnterQueueEvent(this.Manager.Time + transferTime, queue, unitloadToGo); unitloadList.Remove(unitloadToGo); } } } queueList.Clear(); this.PostOperation(); }
private UnitloadList unitloads; //state public Job() { this.completed = new UnitloadList(); this.unitloads = new UnitloadList(); }
//key function to define unitload prioritizing for different implementations protected abstract void Prioritize(UnitloadList unitloadsToProcess);
protected abstract UnitloadList UnitloadListSelection(UnitloadList unitloads);
protected virtual void PostOperation(Station inputStationIn, UnitloadList selectedUnitloadsIn, System.Collections.ArrayList names) { }
public Queue(string nameIn, FLOWObject parentIn, int capacityIn, Node nodeIn) : base(nameIn, parentIn, capacityIn) { this.content = new UnitloadList(); }
protected override UnitloadList SelectUnitloads(Station inputStationIn, UnitloadList unitloadsIn) { UnitloadList selectedUnitloads = new UnitloadList(); return(selectedUnitloads); }
protected abstract UnitloadList SelectUnitloads(Station inputStationIn, UnitloadList unitloadsIn);
protected void PerformCyclicalOrder(Station inputStationIn) { UnitloadListStringDictionary unitloads = new UnitloadListStringDictionary(); UnitloadList orderedUnitloads = new UnitloadList(); JobTypeList jobTypes = new JobTypeList(); int totalRelease = 0; MovableObjectList queueContent = inputStationIn.InQueue.Content; foreach (Unitload unitload in queueContent) { if (unitload.EntryTime == this.Manager.Time) { Job currentJob = (Job)unitload.Parent; if (unitloads.ContainsKey(currentJob.JobType.Name) == false) { UnitloadList jobList = new UnitloadList(); unitloads.Add(currentJob.JobType.Name, jobList); jobList.Add(unitload); jobTypes.Add(currentJob.JobType); } else { UnitloadList jobList = unitloads[currentJob.JobType.Name]; jobList.Add(unitload); } totalRelease++; } } int[] frequency = new int[jobTypes.Count]; int[] remaining = new int[jobTypes.Count]; int[] minimumPosition = new int[jobTypes.Count]; int index = 0; foreach (JobType jobType in jobTypes) { UnitloadList jobList = unitloads[jobType.Name]; frequency[index] = (int)Math.Ceiling((double)totalRelease / jobList.Count); remaining[index] = jobList.Count; minimumPosition[index++] = 0; } while (totalRelease != 0) { int leastPosition = Int32.MaxValue; for (int i = 0; i < jobTypes.Count; i++) { if (minimumPosition[i] < leastPosition) { leastPosition = minimumPosition[i]; } } int mostRemaining = 0; int selectedJobIndex = -1; for (int i = 0; i < jobTypes.Count; i++) { if (minimumPosition[i] == leastPosition) { if (mostRemaining < remaining[i]) { mostRemaining = remaining[i]; selectedJobIndex = i; } } } remaining[selectedJobIndex] = remaining[selectedJobIndex] - 1; if (remaining[selectedJobIndex] == 0) { minimumPosition[selectedJobIndex] = Int32.MaxValue; } else { if (minimumPosition[selectedJobIndex] <= orderedUnitloads.Count) { minimumPosition[selectedJobIndex] = minimumPosition[selectedJobIndex] + frequency[selectedJobIndex]; } } totalRelease--; UnitloadList jobList = unitloads[jobTypes[selectedJobIndex].Name]; orderedUnitloads.Add(jobList[0]); jobList.RemoveAt(0); } queueContent.RemoveRange(queueContent.Count - orderedUnitloads.Count, orderedUnitloads.Count); foreach (Unitload unitload in orderedUnitloads) { queueContent.Add(unitload); } }
protected override void Prioritize(UnitloadList unitloadsIn) { }
public abstract PullDecision PullUnitload(Queue inQueue, UnitloadList unitloadlist);
public virtual void AlwaysPushing(UnitloadList currentlist) { }
public void ExecutePartSequencingForProcessorAlgorithm(UnitloadList unitloadsIn) { this.partSequencingForProcessor.Execute(unitloadsIn); }