LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
MathematicalSolutionMappingOptions.cs
Go to the documentation of this file.
1using System;
2using System.Xml.Serialization;
3
5
6/// <summary>
7/// Defines the options used when mapping a mathematical solver
8/// result back to a normalized lot-sizing solution.
9/// </summary>
10[Serializable]
11[XmlType(TypeName = "mathematicalSolutionMappingOptions")]
13{
14 /// <summary>
15 /// Initializes default mathematical-solution mapping
16 /// options.
17 /// </summary>
19 {
21 1.0e-9;
22
24 true;
25
27 true;
28
30 false;
31 }
32
33 /// <summary>
34 /// Gets or sets the absolute tolerance below which a solver
35 /// value is considered equal to zero.
36 /// </summary>
37 [XmlAttribute("zeroTolerance")]
38 public double ZeroTolerance
39 {
40 get;
41 set;
42 }
43
44 /// <summary>
45 /// Gets or sets a value indicating whether solver values
46 /// considered equal to zero must also be mapped.
47 /// </summary>
48 /// <remarks>
49 /// The default value is <see langword="true"/> so that a
50 /// normalized solution explicitly represents modeled decision
51 /// families even when all their values are zero. This allows
52 /// callers to distinguish a modeled zero-valued decision from
53 /// a decision family that was not part of the mathematical
54 /// model.
55 /// </remarks>
56 [XmlAttribute("includeZeroValues")]
58 {
59 get;
60 set;
61 }
62
63 /// <summary>
64 /// Gets or sets a value indicating whether every mathematical
65 /// domain-key category must have a registered decision mapper.
66 /// </summary>
67 [XmlAttribute("requireKnownCategories")]
69 {
70 get;
71 set;
72 }
73
74 /// <summary>
75 /// Gets or sets a value indicating whether every mathematical
76 /// variable must have a corresponding solver value.
77 /// </summary>
78 /// <remarks>
79 /// This option is normally disabled because some native
80 /// adapters may omit fixed or unused zero-valued variables
81 /// from their normalized result.
82 /// </remarks>
83 [XmlAttribute("requireCompleteVariableValues")]
85 {
86 get;
87 set;
88 }
89
90 /// <summary>
91 /// Validates the mapping options.
92 /// </summary>
93 /// <exception cref="InvalidOperationException">
94 /// Thrown when the zero tolerance is invalid.
95 /// </exception>
96 public void EnsureValid()
97 {
98 if (double.IsNaN(
100 double.IsInfinity(
101 ZeroTolerance) ||
102 ZeroTolerance < 0.0)
103 {
104 throw new InvalidOperationException(
105 "The mathematical-solution mapping zero " +
106 "tolerance must be finite and non-negative.");
107 }
108 }
109
110 /// <summary>
111 /// Creates an independent copy of the mapping options.
112 /// </summary>
113 /// <returns>
114 /// Cloned mathematical-solution mapping options.
115 /// </returns>
133}
bool RequireCompleteVariableValues
Gets or sets a value indicating whether every mathematical variable must have a corresponding solver ...
MathematicalSolutionMappingOptions Clone()
Creates an independent copy of the mapping options.
MathematicalSolutionMappingOptions()
Initializes default mathematical-solution mapping options.
double ZeroTolerance
Gets or sets the absolute tolerance below which a solver value is considered equal to zero.
bool IncludeZeroValues
Gets or sets a value indicating whether solver values considered equal to zero must also be mapped.
bool RequireKnownCategories
Gets or sets a value indicating whether every mathematical domain-key category must have a registered...