LotSizingDataModel.Solver
2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
SolverNativeParameter.cs
Go to the documentation of this file.
1
using
System;
2
using
System.Xml.Serialization;
3
using
LotSizingDataModel.Solver.Common
;
4
5
namespace
LotSizingDataModel.Solver.Configuration
;
6
7
/// <summary>
8
/// Represents a solver-specific parameter that is passed to a
9
/// solver adapter without being interpreted by the generic
10
/// solver layer.
11
/// </summary>
12
[Serializable]
13
[XmlType(TypeName =
"solverNativeParameter"
)]
14
public
sealed
class
SolverNativeParameter
15
{
16
/// <summary>
17
/// Initializes an empty native solver parameter.
18
/// </summary>
19
public
SolverNativeParameter
()
20
{
21
Name
=
22
string
.Empty;
23
24
Value
=
25
string
.Empty;
26
}
27
28
/// <summary>
29
/// Initializes a native solver parameter.
30
/// </summary>
31
/// <param name="name">
32
/// Native parameter name.
33
/// </param>
34
/// <param name="value">
35
/// Native parameter value represented using invariant text.
36
/// </param>
37
/// <param name="solverKind">
38
/// Solver to which the parameter applies.
39
/// </param>
40
public
SolverNativeParameter
(
41
string
name,
42
string
value,
43
SolverKind
solverKind =
SolverKind
.Unknown)
44
: this()
45
{
46
Name
=
47
name;
48
49
Value
=
50
value;
51
52
SolverKind
=
53
solverKind;
54
55
EnsureValid
();
56
}
57
58
/// <summary>
59
/// Gets or sets the solver to which the parameter applies.
60
/// </summary>
61
/// <remarks>
62
/// <see cref="Common.SolverKind.Unknown"/> means that the
63
/// selected adapter decides whether the parameter applies.
64
/// </remarks>
65
[XmlAttribute(
"solverKind"
)]
66
public
SolverKind
SolverKind
67
{
68
get
;
69
set
;
70
}
71
72
/// <summary>
73
/// Gets or sets the native solver parameter name.
74
/// </summary>
75
[XmlAttribute(
"name"
)]
76
public
string
Name
77
{
78
get
;
79
set
;
80
}
81
82
/// <summary>
83
/// Gets or sets the native solver parameter value.
84
/// </summary>
85
[XmlAttribute(
"value"
)]
86
public
string
Value
87
{
88
get
;
89
set
;
90
}
91
92
/// <summary>
93
/// Validates the native solver parameter.
94
/// </summary>
95
/// <exception cref="InvalidOperationException">
96
/// Thrown when the parameter name or value is empty.
97
/// </exception>
98
public
void
EnsureValid
()
99
{
100
if
(
string
.IsNullOrWhiteSpace(
101
Name
))
102
{
103
throw
new
InvalidOperationException(
104
"A native solver parameter name is required."
);
105
}
106
107
if
(
string
.IsNullOrWhiteSpace(
108
Value
))
109
{
110
throw
new
InvalidOperationException(
111
$
"A value is required for native solver "
+
112
$
"parameter '{Name}'."
);
113
}
114
}
115
}
LotSizingDataModel.Solver.Configuration.SolverNativeParameter.Value
string Value
Gets or sets the native solver parameter value.
Definition
SolverNativeParameter.cs:87
LotSizingDataModel.Solver.Configuration.SolverNativeParameter.SolverNativeParameter
SolverNativeParameter()
Initializes an empty native solver parameter.
Definition
SolverNativeParameter.cs:19
LotSizingDataModel.Solver.Configuration.SolverNativeParameter.EnsureValid
void EnsureValid()
Validates the native solver parameter.
Definition
SolverNativeParameter.cs:98
LotSizingDataModel.Solver.Configuration.SolverNativeParameter.SolverNativeParameter
SolverNativeParameter(string name, string value, SolverKind solverKind=SolverKind.Unknown)
Initializes a native solver parameter.
Definition
SolverNativeParameter.cs:40
LotSizingDataModel.Solver.Configuration.SolverNativeParameter.Name
string Name
Gets or sets the native solver parameter name.
Definition
SolverNativeParameter.cs:77
LotSizingDataModel.Solver.Configuration.SolverNativeParameter.SolverKind
SolverKind SolverKind
Gets or sets the solver to which the parameter applies.
Definition
SolverNativeParameter.cs:67
LotSizingDataModel.Solver.Common
Definition
SolverAdapterDescriptor.cs:5
LotSizingDataModel.Solver.Configuration
Definition
SolverLogLevel.cs:4
LotSizingDataModel.Solver
Configuration
SolverNativeParameter.cs
Generated by
1.17.0