2using System.Collections.Generic;
3using System.Xml.Serialization;
21[XmlType(TypeName =
"mathematicalModelSolverSelectionResult")]
24 private readonly List<string> _diagnostics =
49 [XmlAttribute(
"requestedSolver")]
60 [XmlAttribute(
"selectedSolver")]
70 [XmlElement(
"adapterId")]
80 [XmlElement(
"adapterName")]
91 [XmlElement(
"availability")]
116 [XmlArray(
"diagnostics")]
117 [XmlArrayItem(
"diagnostic")]
143 if (!
string.IsNullOrWhiteSpace(
168 ArgumentNullException.ThrowIfNull(
187 selection.Availability
192 in selection.Diagnostics)
194 result.AddDiagnostic(
198 if (selection.Adapter is
207 if (selection.Adapter is not
null)
209 result.AddDiagnostic(
210 $
"Selected adapter '{selection.AdapterName}' " +
211 "does not implement " +
212 $
"{nameof(IMathematicalModelSolverAdapter)}.");
Describes the availability and detected installation details of a mathematical optimization solver.
Represents the result of selecting a solver adapter for a solve request.
SolverKind RequestedSolver
Gets or sets the solver requested by the caller.
string AdapterName
Gets or sets the display name of the selected adapter.
SolverKind SelectedSolver
Gets or sets the solver selected by the selection service.
string AdapterId
Gets or sets the identifier of the selected adapter.
SolverKind SelectedSolver
Gets or sets the solver selected by the general solver-selection service.
static MathematicalModelSolverSelectionResult From(SolverSelectionResult selection)
Creates a mathematical-model solver-selection result from a general solver-selection result.
bool IsSuccessful
Gets a value indicating whether a usable mathematical-model solver adapter was selected.
void AddDiagnostic(string message)
Adds a non-empty diagnostic message.
IMathematicalModelSolverAdapter? Adapter
Gets or sets the selected live mathematical-model solver adapter.
SolverAvailabilityInfo? Availability
Gets or sets the availability information associated with the selected solver.
string AdapterId
Gets or sets the selected adapter identifier.
SolverKind RequestedSolver
Gets or sets the solver requested by the caller.
string AdapterName
Gets or sets the selected adapter display name.
MathematicalModelSolverSelectionResult()
Initializes an empty mathematical-model solver-selection result.
List< string > Diagnostics
Gets the diagnostics produced during adapter selection.
Defines a dynamically discoverable solver adapter capable of solving solver-independent mathematical ...
SolverKind
Identifies a supported mathematical optimization solver.
@ Automatic
The solver is selected automatically from the adapters available on the current computer.
@ Unknown
No solver has been specified.