ULSAlgorithms 1.1.0-g3e5595996d
High-performance exact and heuristic algorithms for uncapacitated lot sizing
Loading...
Searching...
No Matches
UlsFormulationVariableMap.cs
Go to the documentation of this file.
1using System.Collections.ObjectModel;
2
4
5/// <summary>
6/// Maps semantic ULS decisions to solver-independent variable identifiers.
7/// </summary>
8public sealed class UlsFormulationVariableMap
9{
10 private readonly IReadOnlyDictionary<int, int> _production;
11 private readonly IReadOnlyDictionary<int, int> _setup;
12 private readonly IReadOnlyDictionary<int, int> _inventory;
13 private readonly IReadOnlyDictionary<(int First, int Second), int>
14 _disaggregated;
15 private readonly IReadOnlyDictionary<(int From, int To), int>
16 _arcs;
17
18 /// <summary>Initializes a formulation variable map.</summary>
20 IDictionary<int, int>? production = null,
21 IDictionary<int, int>? setup = null,
22 IDictionary<int, int>? inventory = null,
23 IDictionary<(int First, int Second), int>? disaggregated = null,
24 IDictionary<(int From, int To), int>? arcs = null)
25 {
26 _production =
27 new ReadOnlyDictionary<int, int>(
28 production is null
29 ? new Dictionary<int, int>()
30 : new Dictionary<int, int>(production));
31
32 _setup =
33 new ReadOnlyDictionary<int, int>(
34 setup is null
35 ? new Dictionary<int, int>()
36 : new Dictionary<int, int>(setup));
37
38 _inventory =
39 new ReadOnlyDictionary<int, int>(
40 inventory is null
41 ? new Dictionary<int, int>()
42 : new Dictionary<int, int>(inventory));
43
44 _disaggregated =
45 new ReadOnlyDictionary<(int First, int Second), int>(
46 disaggregated is null
47 ? new Dictionary<(int First, int Second), int>()
48 : new Dictionary<(int First, int Second), int>(
49 disaggregated));
50
51 _arcs =
52 new ReadOnlyDictionary<(int From, int To), int>(
53 arcs is null
54 ? new Dictionary<(int From, int To), int>()
55 : new Dictionary<(int From, int To), int>(arcs));
56 }
57
58 /// <summary>Gets production-variable ids by period.</summary>
59 public IReadOnlyDictionary<int, int> Production => _production;
60
61 /// <summary>Gets setup-variable ids by period.</summary>
62 public IReadOnlyDictionary<int, int> Setup => _setup;
63
64 /// <summary>Gets inventory-variable ids by period.</summary>
65 public IReadOnlyDictionary<int, int> Inventory => _inventory;
66
67 /// <summary>
68 /// Gets disaggregated-variable ids. For the facility-location formulation,
69 /// the key is (production period, demand period).
70 /// </summary>
71 public IReadOnlyDictionary<(int First, int Second), int>
72 Disaggregated => _disaggregated;
73
74 /// <summary>
75 /// Gets shortest-path arc-variable ids keyed by (from node, to node).
76 /// </summary>
77 public IReadOnlyDictionary<(int From, int To), int> Arcs => _arcs;
78}
IReadOnlyDictionary< int, int > Inventory
Gets inventory-variable ids by period.
UlsFormulationVariableMap(IDictionary< int, int >? production=null, IDictionary< int, int >? setup=null, IDictionary< int, int >? inventory=null, IDictionary<(int First, int Second), int >? disaggregated=null, IDictionary<(int From, int To), int >? arcs=null)
Initializes a formulation variable map.
IReadOnlyDictionary< int, int > Setup
Gets setup-variable ids by period.
IReadOnlyDictionary< int, int > Production
Gets production-variable ids by period.
IReadOnlyDictionary<(int First, int Second), int > Disaggregated
Gets disaggregated-variable ids. For the facility-location formulation, the key is (production period...
IReadOnlyDictionary<(int From, int To), int > Arcs
Gets shortest-path arc-variable ids keyed by (from node, to node).