2using System.Collections.Generic;
3using System.Xml.Serialization;
20[XmlType(TypeName =
"solverParameters")]
23 private readonly List<SolverNativeParameter>
98 [XmlElement(
"timeLimitSeconds")]
108 [XmlElement(
"threadCount")]
118 [XmlElement(
"randomSeed")]
128 [XmlElement(
"relativeMipGap")]
138 [XmlElement(
"absoluteMipGap")]
149 [XmlElement(
"nodeLimit")]
159 [XmlElement(
"iterationLimit")]
170 [XmlElement(
"solutionLimit")]
180 [XmlElement(
"memoryLimitMegabytes")]
190 [XmlAttribute(
"logLevel")]
204 [XmlElement(
"enablePresolve")]
215 [XmlElement(
"enableCuts")]
225 [XmlElement(
"enableHeuristics")]
236 [XmlAttribute(
"deterministicMode")]
247 [XmlAttribute(
"writeLogFile")]
257 [XmlElement(
"logFilePath")]
268 [XmlAttribute(
"exportModel")]
279 [XmlElement(
"exportModelPath")]
289 [XmlElement(
"progressRecording")]
300 [XmlArray(
"nativeParameters")]
301 [XmlArrayItem(
"parameter")]
313 ValidateFiniteStrictlyPositiveNullable(
317 ValidateStrictlyPositiveNullable(
321 ValidateFiniteNonNegativeNullable(
325 ValidateFiniteNonNegativeNullable(
329 ValidateNonNegativeNullable(
333 ValidateNonNegativeNullable(
337 ValidateStrictlyPositiveNullable(
341 ValidateFiniteStrictlyPositiveNullable(
346 string.IsNullOrWhiteSpace(
349 throw new InvalidOperationException(
350 "A log file path is required when solver log " +
351 "file writing is enabled.");
355 string.IsNullOrWhiteSpace(
358 throw new InvalidOperationException(
359 "A model export path is required when model " +
360 "export is enabled.");
363 ArgumentNullException.ThrowIfNull(
370 in _nativeParameters)
372 if (parameter is
null)
374 throw new InvalidOperationException(
375 "The native-parameter collection cannot " +
376 "contain a null entry.");
384 ValidateFiniteStrictlyPositiveNullable(
393 if (value.Value <= 0.0 ||
399 throw new InvalidOperationException(
400 $
"{propertyName} must be a finite strictly " +
401 "positive number when specified.");
405 private static void ValidateFiniteNonNegativeNullable(
414 if (value.Value < 0.0 ||
420 throw new InvalidOperationException(
421 $
"{propertyName} must be a finite " +
422 "non-negative number when specified.");
426 private static void ValidateStrictlyPositiveNullable(
430 if (value.HasValue &&
433 throw new InvalidOperationException(
434 $
"{propertyName} must be strictly positive " +
439 private static void ValidateNonNegativeNullable(
443 if (value.HasValue &&
446 throw new InvalidOperationException(
447 $
"{propertyName} cannot be negative when " +
Represents a solver-specific parameter that is passed to a solver adapter without being interpreted b...
void EnsureValid()
Validates the native solver parameter.
bool WriteLogFile
Gets or sets whether solver output is written to a log file.
long? IterationLimit
Gets or sets the maximum number of solver iterations.
SolverLogLevel LogLevel
Gets or sets the normalized solver log level.
List< SolverNativeParameter > NativeParameters
Gets solver-specific parameters that are passed directly to the selected adapter.
long? NodeLimit
Gets or sets the maximum number of explored search-tree nodes.
SolverParameters()
Initializes solver parameters with recommended default values.
int? RandomSeed
Gets or sets the solver random seed.
bool ExportModel
Gets or sets whether the generated mathematical model is exported before solving.
string LogFilePath
Gets or sets the solver log file path.
double? MemoryLimitMegabytes
Gets or sets the approximate memory limit, in megabytes.
int? SolutionLimit
Gets or sets the maximum number of feasible solutions to search for.
double? RelativeMipGap
Gets or sets the relative mixed-integer optimality gap.
SolverProgressRecordingOptions ProgressRecording
Gets or sets the progress-history recording options.
bool? EnablePresolve
Gets or sets whether solver presolve is enabled.
bool DeterministicMode
Gets or sets whether deterministic execution is requested when supported by the selected solver.
int? ThreadCount
Gets or sets the maximum number of solver threads.
bool? EnableHeuristics
Gets or sets whether primal heuristics are enabled.
double? TimeLimitSeconds
Gets or sets the wall-clock time limit, in seconds.
string ExportModelPath
Gets or sets the destination path used to export the generated model.
void EnsureValid()
Validates the solver parameters.
bool? EnableCuts
Gets or sets whether automatic cut generation is enabled.
double? AbsoluteMipGap
Gets or sets the absolute mixed-integer optimality gap.
Configures how solver progress snapshots are retained during an optimization run.
SolverLogLevel
Defines the amount of information written by a solver during an optimization run.