public IActionResult Train( string train, string name, string algorithmId, List <string> itemIds ) { AlgorithmParameter algorithmParameter = new AlgorithmParameter(); algorithmParameter.algorithm_parameter_id = 221; algorithmParameter.value = "50"; if (string.IsNullOrEmpty(algorithmId)) { algorithmId = "hacarus-fused-lasso"; } if (string.IsNullOrEmpty(name)) { name = DateTime.Now.ToString(); } ModelResponse response = hacarusVisualInspection.Train(algorithmId, name, itemIds.ToArray(), new AlgorithmParameter[] { algorithmParameter }); Console.WriteLine("IFFFF " + itemIds.Count); ViewData["HttpResponse"] = "Status code: " + (int)response.httpResponse.StatusCode + " " + response.httpResponse.StatusCode; ViewData["StringMessage"] = hacarusVisualInspection.StringMessage; ViewBag.BearerAvailable = !string.IsNullOrEmpty(bearer); ViewBag.Active = "train"; return(Index()); }
protected override void OnParameterChanged(AlgorithmParameter parameter) { if (parameter.Name.Equals("Beta")) { beta = parameter.Value; } }
public override System.Windows.Media.ImageSource SaveImage() { ImageSource result = null; var parameter = new AlgorithmParameter() { Value = (int)SliderOneValue, ParameterName = SliderNameOne }; var parameter1 = new AlgorithmParameter() { Value = (int)SliderTwoValue, ParameterName = SliderNameTwo }; List <AlgorithmParameter> algorithmParameter = new List <AlgorithmParameter>(); algorithmParameter.Add(parameter); algorithmParameter.Add(parameter1); algorithmParameter.Add(lastSelectedColour); result = ImageProcessingAlgorithm.ApplyEffectOnOriginalDimensions(algorithmParameter, out Message); if (!String.IsNullOrEmpty(Message)) { MessageBox.Show("Some error occured \n" + Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } return(result); }
public IActionResult Train( string train, string name, string algorithmId, List <string> itemIds ) { AlgorithmParameter AlgorithmParameter = new AlgorithmParameter(); AlgorithmParameter.AlgorithmParameterId = 221; AlgorithmParameter.Value = "50"; if (string.IsNullOrEmpty(algorithmId)) { algorithmId = "OC"; } if (string.IsNullOrEmpty(name)) { name = DateTime.Now.ToString(); } ModelResponse Result = VisualInspection.Train(algorithmId, name, itemIds.ToArray(), new AlgorithmParameter[] { AlgorithmParameter }); Console.WriteLine("IFFFF " + itemIds.Count); ViewData["HttpResponse"] = "Status code: " + (int)Result.HttpResponse.StatusCode + " " + Result.HttpResponse.StatusCode; ViewData["StringMessage"] = Result.HttpResponse.Content; ViewBag.BearerAvailable = VisualInspection.IsAuthorized; ViewBag.Active = "train"; return(Index()); }
/// <summary> /// Selects the colour and applies the effect /// </summary> /// <param name="colour"></param> void SelectColour(object colour) { if (InputImage != null) { var param = (KeyValuePair <Algorithm.AlgorithmParameter, string>)colour; lastSelectedColour = param.Key; ApplyEffect(); } }
/// <summary> /// Constructor /// </summary> /// <param name="effect"></param> public MultipleChoiceViewModel(Effects effect) { selectMethodCommand = new DelegateCommand(new Action <object>(SelectMethod)); ImageProcessingAlgorithm.SetEffects(effect); AlgorithmOptions = ImageProcessingAlgorithm.GetOptions(effect); var method = AlgorithmOptions.First(x => x.InputType == Algorithm.InputType.MultipleChoice); lastSelected = method.Options.First().Key; }
/// <summary> /// Select method /// </summary> /// <param name="methodName"></param> protected void SelectMethod(object methodName) { lastSelected = methodName as AlgorithmParameter; if (InputImage != null) { List <AlgorithmParameter> algorithmParameter = new List <AlgorithmParameter>(); algorithmParameter.Add(lastSelected); OutputImage = ImageProcessingAlgorithm.ApplyEffect(algorithmParameter, out Message); } }
protected override void OnParameterChanged(AlgorithmParameter parameter) { if (parameter.Name.Equals("Beta")) { beta = parameter.Value; } if (parameter.Name.Equals("WindowSize")) { windowSize = (int) parameter.Value; } }
public MultipleChoiceSliderViewModel(Effects effect) { ImageProcessingAlgorithm.SetEffects(effect); AlgorithmOptions = ImageProcessingAlgorithm.GetOptions(effect); slider = AlgorithmOptions.First(x => x.InputType == Algorithm.InputType.SingleInput); parameterName = (slider.Options.Keys.First() as AlgorithmParameter).ParameterName; SliderValue = Max / 2; var method = AlgorithmOptions.First(x => x.InputType == Algorithm.InputType.MultipleChoice); lastSelected = method.Options.First().Key; selectMethodCommand = new DelegateCommand(new Action <object>(SelectMethod)); }
void SelectColour(object colour) { if (InputImage != null && lastSelected != null) { var param = (KeyValuePair <Algorithm.AlgorithmParameter, string>)colour; lastSelectedColour = param.Key; List <AlgorithmParameter> algorithmParameter = new List <AlgorithmParameter>(); algorithmParameter.Add(lastSelectedColour); algorithmParameter.Add(lastSelected); OutputImage = ImageProcessingAlgorithm.ApplyEffect(algorithmParameter, out Message); } }
protected override void OnParameterChanged(AlgorithmParameter parameter) { if (parameter.Name.Equals("Beta")) { beta = parameter.Value; } if (parameter.Name.Equals("WindowSize")) { windowSize = (int)parameter.Value; } }
/// <summary> /// Algorithm adapted from Imagemagick /// </summary> void ApplyEffect() { if (InputImage != null) { var parameter = new AlgorithmParameter() { Value = (int)sliderValue, ParameterName = parameterName }; List <AlgorithmParameter> algorithmParameter = new List <AlgorithmParameter>(); algorithmParameter.Add(parameter); OutputImage = ImageProcessingAlgorithm.ApplyEffect(algorithmParameter, out Message); } }
private static double[] GetParamterRange(this AlgorithmParameter currentParameter) { if (currentParameter.ValueIsBoolean) { if (currentParameter.UseRange) { return new double[2] { 0, 1 } } ; else { return new double[1] { currentParameter.BooleanValue ? 1 : 0 } }; } else { if (currentParameter.UseRange) { //this is a numerical range, so we recurse through all the parameters /* * NOTE: The double extension method of 'LessThanAlmostEqualTo' is used here * to avoid rounding errors due to binary representation of rational numbers * * DECIMAL datatype is more appropriate for this reason, * however is significantly slower than double. When dealing with * millions of iterations, the double vs decimal speed difference is meaningful */ var values = new List <double>(); for (double r = currentParameter.RangeStart; r.LessThanAlmostEqualTo(currentParameter.RangeEnd); r += currentParameter.RangeStep) { values.Add(r); } return(values.ToArray()); } else { return(new double[1] { currentParameter.NumericValue }); } } }
protected override void OnParameterChanged(AlgorithmParameter parameter) { if (parameter.Name.Equals("L")) { l = parameter.Value; } else if (parameter.Name.Equals("H")) { h = parameter.Value; } else if (parameter.Name.Equals("Omega")) { omega = parameter.Value; } }
protected override void OnParameterChanged(AlgorithmParameter parameter) { if (parameter.Name.Equals("GMin")) { gMin = (int)parameter.Value; } else if (parameter.Name.Equals("GMean")) { gMean = (int)parameter.Value; } else if (parameter.Name.Equals("Gmax")) { gMax = (int)parameter.Value; } }
void SelectMethod(object methodName) { lastSelected = methodName as AlgorithmParameter; if (InputImage != null) { List <AlgorithmParameter> algorithmParameter = new List <AlgorithmParameter>(); var parameter = new AlgorithmParameter() { Value = (int)sliderValue, ParameterName = parameterName }; algorithmParameter.Add(parameter); algorithmParameter.Add(lastSelected); OutputImage = ImageProcessingAlgorithm.ApplyEffect(algorithmParameter, out Message); } }
/// <summary> /// Constructor /// </summary> /// <param name="effect"></param> public DoubleSliderViewModel(Effects effect) { AlgorithmOptions = ImageProcessingAlgorithm.GetOptions(effect); ImageProcessingAlgorithm.SetEffects(effect); sliderOneParam = AlgorithmOptions.First(x => (x.InputType == Algorithm.InputType.SingleInput) && (x.ParameterName == "BlockWidth")); sliderTwoParam = AlgorithmOptions.First(x => (x.InputType == Algorithm.InputType.SingleInput) && (x.ParameterName == "BlockHeight")); SliderOneValue = ((MaxSliderOne - MinSliderOne) / 2) + MinSliderOne; SliderTwoValue = ((MaxSliderTwo - MinSliderTwo) / 2) + MinSliderTwo; var colours = AlgorithmOptions.First(x => x.InputType == Algorithm.InputType.MultipleChoice && x.ParameterName == "BorderColour"); lastSelectedColour = colours.Options.First(x => x.Value == "Gray").Key; selectColour = new DelegateCommand(new Action <object>(SelectColour)); }
protected override void OnParameterChanged(AlgorithmParameter parameter) { if (parameter.Name.Equals("Width")) { widthParam = (int)parameter.Value; } if (parameter.Name.Equals("WindowSize")) { windowSize = (int)parameter.Value; } if (parameter.Name.Equals("Center")) { centerPoint = (int)parameter.Value; } }
protected override void OnParameterChanged(AlgorithmParameter parameter) { if (parameter.Name.Equals("ExponentialFuzzifier")) { exponentialFuzzifier = parameter.Value; } else if (parameter.Name.Equals("Crossover")) { crossoverPoint = (int) parameter.Value; } else if (parameter.Name.Equals("Iterations")) { iterations = Convert.ToInt32(Math.Round(parameter.Value, MidpointRounding.AwayFromZero)); } else if (parameter.Name.Equals("DesiredFuzziness")) { desiredFuzziness = parameter.Value; } }
/// <summary> /// Constructor /// </summary> /// <param name="effect"></param> public MultipleChoiceColourSelectionViewModel(Algorithm.Effects effect) { selectMethodCommand = new DelegateCommand(new Action <object>(SelectMethod)); selectColour = new DelegateCommand(new Action <object>(SelectColour)); ImageProcessingAlgorithm.SetEffects(effect); AlgorithmOptions = ImageProcessingAlgorithm.GetOptions(effect); if (effect == Effects.XRay) { lastSelected = new AlgorithmParameter(); } else { var method = AlgorithmOptions.First(x => x.InputType == Algorithm.InputType.MultipleChoice && x.ParameterName == "Method"); lastSelected = method.Options.First().Key; } var colours = AlgorithmOptions.First(x => x.InputType == Algorithm.InputType.MultipleChoice && x.ParameterName == "Colour"); lastSelectedColour = colours.Options.First(x => x.Value == "Gray").Key; }
protected override void OnParameterChanged(AlgorithmParameter parameter) { if (parameter.Name.Equals("ExponentialFuzzifier")) { exponentialFuzzifier = parameter.Value; } else if (parameter.Name.Equals("Crossover")) { crossoverPoint = (int)parameter.Value; } else if (parameter.Name.Equals("Iterations")) { iterations = Convert.ToInt32(Math.Round(parameter.Value, MidpointRounding.AwayFromZero)); } else if (parameter.Name.Equals("DesiredFuzziness")) { desiredFuzziness = parameter.Value; } }
private static void IterateSingleParameter(ApproachDefinition approach, AlgorithmParameter currentParameter, RunDefinitionBuffer buffer) { if (currentParameter.UseRange) { if (currentParameter.ValueIsBoolean) { //The boolean range is only 2 values...so we just set those two and recurse the other parameters currentParameter.BooleanValue = true; buffer.AddAsync(new RunDefinition(approach)); currentParameter.BooleanValue = false; buffer.AddAsync(new RunDefinition(approach)); } else { //this is a numerical range, so we recurse through all the parameters /* * NOTE: The double extension method of 'LessThanAlmostEqualTo' is used here * to avoid rounding errors due to binary representation of rational numbers * * DECIMAL datatype is more appropriate for this reason, * however is significantly slower than double. When dealing with * millions of iterations, the double vs decimal speed difference is meaningful */ for (double r = currentParameter.RangeStart; r.LessThanAlmostEqualTo(currentParameter.RangeEnd); r += currentParameter.RangeStep) { if (CancelGeneration) { return; //this will prevent an new definitions from buffering, but it still needs to unwind the stack } currentParameter.NumericValue = r; buffer.AddAsync(new RunDefinition(approach)); } } currentParameter.NumericValue = currentParameter.RangeStart; } else { buffer.AddAsync(new RunDefinition(approach)); } }
/// <summary> /// Gets image to save in original size /// </summary> /// <returns></returns> public override ImageSource SaveImage() { ImageSource result = null; if (InputImage != null) { var parameter = new AlgorithmParameter() { Value = (int)sliderValue, ParameterName = parameterName }; List <AlgorithmParameter> algorithmParameter = new List <AlgorithmParameter>(); algorithmParameter.Add(parameter); result = ImageProcessingAlgorithm.ApplyEffectOnOriginalDimensions(algorithmParameter, out Message); if (!String.IsNullOrEmpty(Message)) { MessageBox.Show("Some error occured \n" + Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } return(result); }
/// <summary> /// Apply the effect on change of slider value or colour change /// </summary> void ApplyEffect() { if (InputImage != null) { var parameter = new AlgorithmParameter() { Value = (int)SliderOneValue, ParameterName = SliderNameOne }; var parameter1 = new AlgorithmParameter() { Value = (int)SliderTwoValue, ParameterName = SliderNameTwo }; List <AlgorithmParameter> algorithmParameter = new List <AlgorithmParameter>(); algorithmParameter.Add(parameter); algorithmParameter.Add(parameter1); algorithmParameter.Add(lastSelectedColour); OutputImage = ImageProcessingAlgorithm.ApplyEffect(algorithmParameter, out Message); } }
public static IParameterInput CreateInput_String(AlgorithmParameter parameter) { return new StringParameterInput(parameter as AlgorithmParameter<string>); }
public static IParameterInput CreateInput_Parametrizable(AlgorithmParameter parameter) { return new ParametrizableParameterInput(parameter as ParametrizedObjectParameter); }
public static IParameterInput CreateInput_Int(AlgorithmParameter parameter) { return new IntParameterInput(parameter as AlgorithmParameter<int>); }
public static IParameterInput CreateInput_Float(AlgorithmParameter parameter) { return new FloatParameterInput(parameter as AlgorithmParameter<float>); }
public static IParameterInput CreateInput_Double(AlgorithmParameter parameter) { return new DoubleParameterInput(parameter as AlgorithmParameter<double>); }
protected override void OnParameterChanged(AlgorithmParameter parameter) { if (parameter.Name.Equals("Width")) { widthParam = (int) parameter.Value; } if (parameter.Name.Equals("WindowSize")) { windowSize = (int) parameter.Value; } if (parameter.Name.Equals("Center")) { centerPoint = (int) parameter.Value; } }
protected override void OnParameterChanged(AlgorithmParameter parameter) { if (parameter.Name.Equals("GMin")) { gMin = (int) parameter.Value; } else if (parameter.Name.Equals("GMean")) { gMean = (int) parameter.Value; } else if (parameter.Name.Equals("Gmax")) { gMax = (int) parameter.Value; } }
public short?GetShort(string name) { _parameter = _parameters.FirstOrDefault(p => p.ParameterType.ToLower() == "short" && p.ParameterName.ToLower() == name.ToLower()); try { return(Convert.ToInt16(_parameter.ParameterValue)); } catch { return(null); } }
protected void AddParameter(AlgorithmParameter parameter) { parameters.Add(parameter); parameter.PropertyChanged += OnParameterValueChanged; }
public long?GetLong(string name) { _parameter = _parameters.FirstOrDefault(p => p.ParameterType.ToLower() == "long" && p.ParameterName.ToLower() == name.ToLower()); try { return(Convert.ToInt64(_parameter.ParameterValue)); } catch { return(null); } }
public int?GetInteger(string name) { _parameter = _parameters.FirstOrDefault(p => p.ParameterType.ToLower() == "integer" && p.ParameterName.ToLower() == name.ToLower()); try { return(Convert.ToInt32(_parameter.ParameterValue)); } catch { return(null); } }
public bool?GetBoolean(string name) { _parameter = _parameters.FirstOrDefault(p => p.ParameterType.ToLower() == "boolean" && p.ParameterName.ToLower() == name.ToLower()); try { return(Convert.ToBoolean(_parameter.ParameterValue)); } catch { return(null); } }
protected virtual void OnParameterChanged(AlgorithmParameter parameter) { }
public string GetString(string name) { _parameter = _parameters.FirstOrDefault(p => p.ParameterType.ToLower() == "string" && p.ParameterName.ToLower() == name.ToLower()); return(_parameter.ParameterValue); }
public decimal?GetDecimal(string name) { _parameter = _parameters.FirstOrDefault(p => p.ParameterType.ToLower() == "decimal" && p.ParameterName.ToLower() == name.ToLower()); try { return(Convert.ToDecimal(_parameter.ParameterValue)); } catch { return(null); } }
public static IParameterInput CreateInput_Boolean(AlgorithmParameter parameter) { return new BooleanParameterInput(parameter as AlgorithmParameter<bool>); }
public static IParameterInput CreateInput_Combo(AlgorithmParameter parameter) { return new ComboParameterInput(parameter as DictionaryParameter); }
public void BuildStatisticsReport(SimulationManager simulationManager, string reporterPath) { StringWriter writer = new StringWriter(); writer.WriteLine("<Report>"); #region Basic Parameters SimulationParameter parameter = simulationManager.Parameter; writer.WriteLine("<JobPath>{0}</JobPath>", parameter.JobPath); writer.WriteLine("<LayoutPath>{0}</LayoutPath>", parameter.LayoutPath); writer.WriteLine("<Seed>{0}</Seed>", parameter.Seed); #endregion #region Algorithm Names AlgorithmParameter algorithms = parameter.Algorithms; writer.WriteLine(String.Format("<OperationSelection>{0}</OperationSelection>", algorithms.OperationSelectionAlgorithm)); writer.WriteLine(String.Format("<OrderRelease>{0}</OrderRelease>", algorithms.OrderReleaseAlgorithm)); writer.WriteLine(String.Format("<StationController>{0}</StationController>", algorithms.StationControllerAlgorithm)); writer.WriteLine(String.Format("<OrderController>{0}</OrderController>", algorithms.OrderControllerAlgorithm)); writer.WriteLine(String.Format("<PartSequencingForProcessor>{0}</PartSequencingForProcessor>", algorithms.PartSequencingForProcessorAlgorithm)); //writer.WriteLine(String.Format("<PartSequencingForOutQueue>{0}</PartSequencingForOutQueue>", algorithms.PartSequencingForOutQueueAlgorithm)); #endregion #region Configuration Parameters ConfigurationParameter configuration = parameter.Configuration; writer.WriteLine(String.Format("<FinalArrivalTime>{0}</FinalArrivalTime>", configuration.FinalArrivalTime)); writer.WriteLine(String.Format("<JobRelease>{0}</JobRelease>", configuration.JobRelease)); writer.WriteLine(String.Format("<JobArrivalType>{0}</JobArrivalType>", configuration.JobArrivalType)); writer.WriteLine(String.Format("<LoadingPeriodTime>{0}</LoadingPeriodTime>", configuration.LoadingPeriodTime)); writer.WriteLine(String.Format("<LoadingPeriodType>{0}</LoadingPeriodType>", configuration.LoadingPeriodType)); writer.WriteLine(String.Format("<PeriodState>{0}</PeriodState>", configuration.PeriodState)); writer.WriteLine(String.Format("<PlanningPeriodTime>{0}</PlanningPeriodTime>", configuration.PlanningPeriodTime)); writer.WriteLine(String.Format("<PlanningPeriodType>{0}</PlanningPeriodType>", configuration.PlanningPeriodType)); writer.WriteLine(String.Format("<SimulationPeriodTime>{0}</SimulationPeriodTime>", configuration.SimulationPeriodTime)); writer.WriteLine(String.Format("<SimulationPeriodType>{0}</SimulationPeriodType>", configuration.SimulationPeriodType)); writer.WriteLine(String.Format("<ToolPath>{0}</ToolPath>", configuration.ToolPath)); writer.WriteLine(String.Format("<TracePath>{0}</TracePath>", configuration.TracePath)); writer.WriteLine(String.Format("<WarmupPeriodTime>{0}</WarmupPeriodTime>", configuration.WarmupPeriodTime)); #endregion #region Transporter Statistics writer.WriteLine("<Transporter>"); Transporter transporter = simulationManager.LayoutManager.Layout.Transporter; writer.WriteLine("<Name>{0}</Name>", transporter.Name); writer.WriteLine("<Statistics>"); Statistics load = (Statistics)transporter.Statistics["Load"]; writer.WriteLine(ReportUtilizationBasedStatistics("Load", load, simulationManager)); Statistics busy = (Statistics)transporter.Statistics["Busy"]; writer.WriteLine(ReportUtilizationBasedStatistics("Busy", busy, simulationManager)); writer.WriteLine("</Statistics>"); writer.WriteLine("</Transporter>"); #endregion #region Cell Statistics writer.WriteLine("<Cells>"); foreach (Station cell in simulationManager.LayoutManager.Layout.Stations) { writer.WriteLine("<Cell>"); writer.WriteLine("<Name>{0}</Name>", cell.Name); writer.WriteLine("<Statistics>"); if (cell.GetType().Name == "Station") { Statistics blocked = (Statistics)cell.Statistics["Blocked"]; writer.WriteLine(ReportUtilizationBasedStatistics("Blocked", blocked, simulationManager)); } if (cell.GetType().Name == "Station") { Statistics starved = (Statistics)cell.Statistics["Starved"]; writer.WriteLine(ReportUtilizationBasedStatistics("Starved", starved, simulationManager)); } Statistics inqueueLength = (Statistics)cell.InQueue.Statistics["Length"]; writer.WriteLine(ReportTimeBasedStatistics("InqueueLength", inqueueLength, simulationManager)); Statistics inqueueTime = (Statistics)cell.InQueue.Statistics["Time"]; writer.WriteLine(ReportAverageBasedStatistics("InqueueTime", inqueueTime)); writer.WriteLine("</Statistics>"); if (cell.GetType().Name == "Station") { Station processCell = (Station)cell; writer.WriteLine("<Processors>"); foreach (Processor processor in processCell.Processors) { writer.WriteLine("<Processor>"); writer.WriteLine("<Name>{0}</Name>", processor.Name); writer.WriteLine("<Statistics>"); Statistics usage = (Statistics)processor.Statistics["Usage"]; writer.WriteLine(ReportUtilizationBasedStatistics("Usage", usage, simulationManager)); Statistics blocked = (Statistics)processor.Statistics["Blocked"]; writer.WriteLine(ReportUtilizationBasedStatistics("Blocked", blocked, simulationManager)); Statistics starved = (Statistics)processor.Statistics["Starved"]; writer.WriteLine(ReportUtilizationBasedStatistics("Starved", starved, simulationManager)); writer.WriteLine("</Statistics>"); writer.WriteLine("</Processor>"); } writer.WriteLine("</Processors>"); } writer.WriteLine("</Cell>"); } writer.WriteLine("</Cells>"); #endregion #region JobType Statistics writer.WriteLine("<JobTypes>"); foreach (JobType jobType in simulationManager.JobManager.JobMix.JobTypes) { writer.WriteLine("<JobType>"); writer.WriteLine("<Name>{0}</Name>", jobType.Name); writer.WriteLine("<Statistics>"); Statistics submitted = (Statistics)jobType.Statistics["Submitted"]; writer.WriteLine(ReportCountBasedStatistics("Submitted", submitted)); Statistics completed = (Statistics)jobType.Statistics["Completed"]; writer.WriteLine(ReportCountBasedStatistics("Completed", completed)); Statistics shopTime = (Statistics)jobType.Statistics["ShopTime"]; writer.WriteLine(ReportAverageBasedStatistics("ShopTime", shopTime)); Statistics totalTime = (Statistics)jobType.Statistics["TotalTime"]; writer.WriteLine(ReportAverageBasedStatistics("TotalTime", totalTime)); Statistics lateness = (Statistics)jobType.Statistics["Lateness"]; writer.WriteLine(ReportAverageBasedStatistics("Lateness", lateness)); Statistics earliness = (Statistics)jobType.Statistics["Earliness"]; writer.WriteLine(ReportAverageBasedStatistics("Earliness", earliness)); Statistics tardiness = (Statistics)jobType.Statistics["Tardiness"]; writer.WriteLine(ReportAverageBasedStatistics("Tardiness", tardiness)); Statistics numberofTardyJobs = (Statistics)jobType.Statistics["NumberofTardyJobs"]; writer.WriteLine(ReportCountBasedStatistics("NumberofTardyJobs", numberofTardyJobs)); writer.WriteLine("</Statistics>"); writer.WriteLine("<Alternates>"); foreach (JobRoute alternate in jobType.Alternates) { writer.WriteLine("<Alternate>"); writer.WriteLine("<Name>" + alternate.Name + "</Name>"); Statistics usage = (Statistics)alternate.Usage; writer.WriteLine(ReportCountBasedStatistics("UsageCount", usage)); writer.WriteLine("</Alternate>"); } writer.WriteLine("</Alternates>"); writer.WriteLine("</JobType>"); } writer.WriteLine("</JobTypes>"); #endregion #region BinMagazine Statistics writer.WriteLine("<BinMagazines>"); foreach (Station station in simulationManager.LayoutManager.Layout.Stations) { if (!(simulationManager.LayoutManager.Layout.InputStations.Contains(station) || simulationManager.LayoutManager.Layout.OutputStations.Contains(station))) { writer.WriteLine("<BinMagazine>"); writer.WriteLine("<Name>{0}</Name>", station.BinMagazine.Name); writer.WriteLine("<Statistics>"); Statistics leadtime = (Statistics)station.BinMagazine.Statistics["OrderLeadTime"]; writer.WriteLine(ReportAverageBasedStatistics("OrderLeadTime", leadtime)); Statistics outstanding = (Statistics)station.BinMagazine.Statistics["OutstandingOrderCount"]; writer.WriteLine(ReportUtilizationBasedStatistics("OutstandingOrderCount", outstanding, simulationManager)); foreach (ComponentType ct in station.BinMagazine.ComponentTypes) { Statistics componentcount = (Statistics)station.BinMagazine.Statistics["ComponentTypeCount-" + ct.Name]; writer.WriteLine(ReportUtilizationBasedStatistics("ComponentTypeCount-" + ct.Name, componentcount, simulationManager)); Statistics bintime = (Statistics)station.BinMagazine.Statistics["BinTime-" + ct.Name]; writer.WriteLine(ReportAverageBasedStatistics("BinTime-" + ct.Name, bintime)); } writer.WriteLine("</Statistics>"); writer.WriteLine("</BinMagazine>"); } } writer.WriteLine("</BinMagazines>"); #endregion writer.WriteLine("</Report>"); XmlDocument document = new XmlDocument(); string s = writer.ToString().Trim(); document.LoadXml(s); document.Save(String.Format(reporterPath + "{0}.xml", Guid.NewGuid())); }