LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
StandardFormulationResourceEnumerator.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using LotSizingDataModel.Core;
4using LotSizingDataModel.Core.PhysicalModel;
5
7
8/// <summary>
9/// Enumerates physical resources together with the canonical
10/// references required by the mathematical formulation.
11/// </summary>
13{
14 /// <summary>
15 /// Enumerates every standalone and plant warehouse.
16 /// </summary>
17 /// <param name="supplyChain">
18 /// Source supply chain.
19 /// </param>
20 /// <returns>
21 /// Warehouse/reference pairs.
22 /// </returns>
23 public static IEnumerable<(
24 WarehouseReference Reference,
25 Warehouse Warehouse)> EnumerateWarehouses(
26 SupplyChain supplyChain)
27 {
28 ArgumentNullException.ThrowIfNull(
29 supplyChain);
30
31 foreach (
32 StandaloneWarehouse warehouse
33 in supplyChain.StandaloneWarehouses)
34 {
35 yield return (
36 WarehouseReference.ForStandaloneWarehouse(
37 warehouse.Id),
38 warehouse);
39 }
40
41 foreach (
42 Plant plant
43 in supplyChain.Plants)
44 {
45 yield return (
46 WarehouseReference.ForPlantWarehouse(
47 plant.Id),
48 plant.Warehouse);
49 }
50 }
51
52 /// <summary>
53 /// Enumerates every work center with its containing plant
54 /// identifier.
55 /// </summary>
56 /// <param name="supplyChain">
57 /// Source supply chain.
58 /// </param>
59 /// <returns>
60 /// Plant/work-center pairs.
61 /// </returns>
62 public static IEnumerable<(
63 int PlantId,
64 WorkCenter WorkCenter)> EnumerateWorkCenters(
65 SupplyChain supplyChain)
66 {
67 ArgumentNullException.ThrowIfNull(
68 supplyChain);
69
70 foreach (
71 Plant plant
72 in supplyChain.Plants)
73 {
74 foreach (
75 WorkCenter workCenter
76 in plant.WorkCenters)
77 {
78 yield return (
79 plant.Id,
80 workCenter);
81 }
82 }
83 }
84}
Enumerates physical resources together with the canonical references required by the mathematical for...
static IEnumerable<(WarehouseReference Reference, Warehouse Warehouse)> EnumerateWarehouses(SupplyChain supplyChain)
Enumerates every standalone and plant warehouse.
static IEnumerable<(int PlantId, WorkCenter WorkCenter)> EnumerateWorkCenters(SupplyChain supplyChain)
Enumerates every work center with its containing plant identifier.