2using System.Collections.Generic;
3using System.Xml.Serialization;
13[XmlType(TypeName =
"solverSelectionOptions")]
16 private readonly List<SolverKind> _solverPriority =
19 private readonly List<SolverCapability>
20 _requiredCapabilities =
55 [XmlArray(
"solverPriority")]
56 [XmlArrayItem(
"solver")]
64 [XmlArray(
"requiredCapabilities")]
65 [XmlArrayItem(
"capability")]
67 _requiredCapabilities;
73 [XmlAttribute(
"allowLimitedAvailability")]
84 [XmlAttribute(
"requireExactSolverKind")]
100 if (_solverPriority.Count == 0)
102 throw new InvalidOperationException(
103 "At least one solver kind must be present in " +
104 "the automatic-selection priority.");
108 new HashSet<SolverKind>();
118 throw new InvalidOperationException(
119 "The solver priority must contain only " +
120 "concrete solver kinds.");
123 if (!seenSolvers.Add(
126 throw new InvalidOperationException(
127 $
"Solver kind '{solverKind}' appears more " +
128 "than once in the selection priority.");
132 var seenCapabilities =
133 new HashSet<SolverCapability>();
137 in _requiredCapabilities)
142 throw new InvalidOperationException(
143 "The required-capability collection cannot " +
147 if (!seenCapabilities.Add(
150 throw new InvalidOperationException(
151 $
"Capability '{capability}' appears more " +
152 "than once in the required-capability " +
bool RequireExactSolverKind
Gets or sets whether a preferred concrete solver must be used without falling back to another solver.
SolverSelectionOptions()
Initializes solver-selection options with the default solver priority.
void EnsureValid()
Validates the solver-selection options.
List< SolverCapability > RequiredCapabilities
Gets the capabilities that a selected adapter must support.
bool AllowLimitedAvailability
Gets or sets whether adapters reported as available with limitations may be selected.
List< SolverKind > SolverPriority
Gets the solver priority used during automatic selection.
SolverKind
Identifies a supported mathematical optimization solver.
SolverCapability
Identifies an optional capability implemented by a solver adapter.