HxParam Class¶
-
class
Hexaly.Optimizer.HxParam¶ Solving parameters. This class contains some methods allowing you to parameterize the resolution of the model. For the sake of simplicity, only a few parameters are actually offered to tune the search.
Summary¶
GetOptimizer |
Returns the Hexaly Optimizer object associated to these parameters. |
SetSeed |
Sets the seed of the pseudo-random number generator used by the solver. |
GetSeed |
Gets the seed of the pseudo-random number generator used by the solver. |
SetNbThreads |
Sets the number of threads used to parallelize the search. |
GetNbThreads |
Gets the number of threads. |
SetNbDisplayedObjectives |
Sets the maximum number of objectives to display. |
GetNbDisplayedObjectives |
Gets the maximum number of objectives to display. |
SetNbDisplayedViolatedConstraints |
Sets the maximum number of violated constraints to display. |
GetNbDisplayedViolatedConstraints |
Gets the maximum number of violated constraints to display. |
SetWarningLevel |
Sets the warning level. |
GetWarningLevel |
Gets the warning level. |
SetTimeLimit |
Sets the time limit in seconds. |
GetTimeLimit |
Gets the time limit in seconds. |
SetIterationLimit |
Sets the maximum number of iterations. |
GetIterationLimit |
Gets the maximum number of iterations. |
SetGapLimit |
Sets the optimality gap used as a termination criterion. |
GetGapLimit |
Gets the optimality gap used as a termination criterion. |
SetVerbosity |
Sets the verbosity level of the solver. |
GetVerbosity |
Gets the verbosity level of the solver. |
SetTimeBetweenDisplays |
Sets the time in seconds between two consecutive displays in console while the solver is running. |
GetTimeBetweenDisplays |
Gets the time in seconds between two consecutive displays in console while the solver is running. |
SetTimeBetweenTicks |
Sets the time in seconds between two events of type LSCallbackType.TimeTicked. |
GetTimeBetweenTicks |
Gets the time in seconds between two events of type LSCallbackType.TimeTicked. |
SetIterationBetweenTicks |
Sets the number of iterations between two events of type LSCallbackType.IterationTicked. |
GetIterationBetweenTicks |
Gets the number of iterations between two events of type LSCallbackType.IterationTicked. |
SetLogWriter |
Sets the writer used by Hexaly Optimizer for its logging. |
GetLogWriter |
Returns the writer used by Hexaly Optimizer for its logging. |
SetLogFile |
Sets the path of the Hexaly Optimizer log file. |
GetLogFile |
Returns the path of the Hexaly Optimizer log file. |
SetObjectiveThreshold |
Sets the threshold of the objective with the given index. |
SetIntObjectiveThreshold |
Sets the threshold of the objective with the given index. |
SetDoubleObjectiveThreshold |
Sets the threshold of the objective with the given index. |
GetObjectiveThreshold |
Gets the threshold of the objective with the given index. |
GetIntObjectiveThreshold |
Gets the threshold of the objective with the given index. |
GetDoubleObjectiveThreshold |
Gets the threshold of the objective with the given index. |
SetAdvancedParam |
Reserved for maintenance purpose. |
GetAdvancedParam |
Reserved for maintenance purpose. |
ToString |
Returns a string representation of these parameters. |
Instance methods¶
-
HexalyOptimizer
GetOptimizer()¶ Returns the Hexaly Optimizer object associated to these parameters.
Returns: HexalyOptimizer object Return type: HexalyOptimizer
-
void
SetSeed(int seed)¶ Sets the seed of the pseudo-random number generator used by the solver. The seed must be a positive integer. The default seed is set to 0. Only allowed in states
ModelingorStopped.Arguments: seed (int) – Seed of the pseudo-random number generator.
-
int
GetSeed()¶ Gets the seed of the pseudo-random number generator used by the solver.
Returns: Seed of the pseudo-random number generator. See: HxParam.SetSeed
-
void
SetNbThreads(int nbThreads)¶ Sets the number of threads used to parallelize the search. The number of threads must be a positive integer. The default number of threads is set to 0 which means that the number of threads is automatically adapted to your computer and to your optimization model. When set to 0, the system will create at least 4 threads by default, as it is recommended to have at least 4 physical cores for nominal performance. Only allowed in states
ModelingorStopped.This parameter is indicative, if needed Hexaly Optimizer may use more threads. The actual number of threads can also vary during the search.
Arguments: nbThreads (int) – Number of threads.
-
int
GetNbThreads()¶ Gets the number of threads. By convention, value 0 means that the number of threads is automatically adapted to your computer and to your optimization model.
Returns: Number of threads. See: HxParam.SetNbThreads
-
void
SetNbDisplayedObjectives(int nbDisplayedObjectives)¶ Sets the maximum number of objectives to display. Only allowed in states
ModelingorStopped.Arguments: nbDisplayedObjectives – Maximum number of objectives to display.
-
int
GetNbDisplayedObjectives()¶ Gets the maximum number of objectives to display.
Returns: Maximum number of objectives to display. See: HxParam.SetNbDisplayedObjectives
-
void
SetNbDisplayedViolatedConstraints(int nbDisplayedViolatedConstraints)¶ Sets the maximum number of violated constraints to display. Only allowed in states
ModelingorStopped.Arguments: nbDisplayedViolatedConstraints – Maximum number of violated constraints to display.
-
int
GetNbDisplayedViolatedConstraints()¶ Gets the maximum number of violated constraints to display.
Returns: Maximum number of violated constraints to display. See: HxParam.SetNbDisplayedViolatedConstraints
-
void
SetWarningLevel(int warningLevel)¶ Sets the warning level. The default warning level is set to 1. Only allowed in states
ModelingorStopped.There are 3 defined warning levels:
- 0: Disable warning computation.
- 1: Automatic behavior (default) - warnings related to the solver configuration are displayed by default. Modeling warnings are not computed.
- 2: Compute all warnings, including modeling warnings.
Modeling warnings are raised when a constraint or objective cannot be proven to be well defined. If such a warning appears, it indicates a modeling issue in the formulation. In cases where this kind of warning should not appear, it may be because Hexaly does not have sufficient tools to prove it.
For more information about modeling warnings, please refer to the warning section of Debugging a Model.
Arguments: warningLevel – Warning level: 0, 1, 2.
-
int
GetWarningLevel()¶ Gets the warning level.
Returns: Warning level: 0, 1 or 2. See: HxParam.SetWarningLevel
-
void
SetTimeLimit(int timeLimit)¶ Sets the time limit in seconds. Only allowed in states
ModelingorStopped.This is not allowed if you have defined multiple phases. Use
HxPhase.SetTimeLimitto set the limit for each phase instead.Arguments: timeLimit (int) – Time limit in seconds. See: HxPhase
-
int
GetTimeLimit()¶ Gets the time limit in seconds.
This is not allowed if you have defined multiple phases. Use
HxPhase.GetTimeLimitinstead.Returns: Time limit in seconds. See: HxParam.SetTimeLimit See: HxPhase
-
void
SetIterationLimit(long iterationLimit)¶ Sets the maximum number of iterations. Only allowed in states
ModelingorStopped.Arguments: iterationLimit (long) – Iteration limit. See: HxPhase
-
long
GetIterationLimit()¶ Gets the maximum number of iterations.
Returns: Iteration limit. See: HxParam.SetIterationLimit See: HxPhase
-
void
SetGapLimit(double gapLimit)¶ Sets the optimality gap used as a termination criterion. When the solver detects that the current gap is below this limit, the current solution is considered optimal. Only allowed in states
ModelingorStopped.Arguments: gapLimit (double) – Gap limit.
-
double
GetGapLimit()¶ Gets the optimality gap used as a termination criterion. When the solver detects that the current gap is below this limit, the current solution is considered optimal.
Returns: Gap limit. See: HxParam.SetGapLimit
-
void
SetVerbosity(int verbosity)¶ Sets the verbosity level of the solver. The default verbosity is set to 1. Only allowed in states
ModelingorStopped. There are 3 defined verbosity levels:- 0: All the traces are disabled.
- 1: Normal verbosity. This is the default level.
- 2: Detailed verbosity. Displays statistics during the search.
Arguments: verbosity (int) – Verbosity level: 0, 1, 2.
-
int
GetVerbosity()¶ Gets the verbosity level of the solver.
Returns: verbosity Verbosity level: 0, 1 or 2. See: HxParam.SetVerbosity
-
void
SetTimeBetweenDisplays(int timeBetweenDisplays)¶ Sets the time in seconds between two consecutive displays in console while the solver is running. The default time between displays is set to 1 second. Only allowed in states
ModelingorStopped.Arguments: timeBetweenDisplays (int) – Time in seconds between displays.
-
int
GetTimeBetweenDisplays()¶ Gets the time in seconds between two consecutive displays in console while the solver is running.
Returns: Time in seconds between displays. Return type: int See: HxParam.SetTimeBetweenDisplays
-
void
SetTimeBetweenTicks(int timeBetweenTicks)¶ Sets the time in seconds between two events of type
LSCallbackType.TimeTicked. The default time between ticks is set to 1 second. Only allowed in statesModelingorStopped.Since: 6.0 Arguments: timeBetweenTicks (int) – Time in seconds between ticks.
-
int
GetTimeBetweenTicks()¶ Gets the time in seconds between two events of type
LSCallbackType.TimeTicked.Since: 6.0 Returns: Time in seconds between ticks. See: HxParam.SetTimeBetweenTicks
-
void
SetIterationBetweenTicks(long iterationBetweenTicks)¶ Sets the number of iterations between two events of type
LSCallbackType.IterationTicked. The default number of iterations between ticks is set to 10,000. Only allowed in statesModelingorStopped.Since: 6.0 Arguments: iterationBetweenTicks (long) – Number of iterations between ticks.
-
long
GetIterationBetweenTicks()¶ Gets the number of iterations between two events of type
LSCallbackType.IterationTicked.Since: 6.0 Returns: Number of iterations between ticks. See: HxParam.SetIterationBetweenTicks
-
void
SetLogWriter(System.IO.TextWriter writer)¶ Sets the writer used by Hexaly Optimizer for its logging. The default is to log to the standard output. To tune the logging verbosity of the output, see
SetVerbosity. Note that you can specify both the log writer and the log file by using the methodSetLogFile.Arguments: writer – Writer for the logging or null to disable logging. Since: 9.5
-
System.IO.TextWriter
GetLogWriter()¶ Returns the writer used by Hexaly Optimizer for its logging. The default value is initialized to the standard output, retrieved with
Console.Out. If no console is available, logging is disabled.To tune the logging verbosity of the output, see
SetVerbosity.Returns: The writer used by Hexaly Optimizer for its logging or null if logging is disabled. Since: 9.5
-
void
SetLogFile(string path)¶ Sets the path of the Hexaly Optimizer log file. If the path is empty, no log will be saved. To tune the logging verbosity, see
HxParam.SetVerbosity. Only allowed in statesModelingorStopped.Arguments: path (string) – Path of the log file. Leave empty to disable the logging mechanism. See: HxParam.SetVerbosity See: HxParam.GetLogFile
-
string
GetLogFile()¶ Returns the path of the Hexaly Optimizer log file. If no log file was specified, an empty string is returned.
Returns: The path of the log file or an empty string. See: HxParam.SetLogFile
-
void
SetObjectiveThreshold(int objectiveIndex, long threshold)¶ Sets the threshold of the objective with the given index. If the objective is minimized (resp. maximized), then the optimization of this objective is stopped as soon as this lower (resp. upper) threshold is reached. It can be useful for goal programming. Only allowed in states
Stopped.This method has the same behavior as
HxParam.SetIntObjectiveThreshold.Since: 8.5
Arguments: - objectiveIndex (int) – Index of the objective.
- threshold (long) – Objective threshold.
See: See:
-
void
SetObjectiveThreshold(int objectiveIndex, double threshold) Sets the threshold of the objective with the given index. If the objective is minimized (resp. maximized), then the optimization of this objective is stopped as soon as this lower (resp. upper) threshold is reached. It can be useful for goal programming. Only allowed in states
Stopped.This method has the same behavior as
HxParam.SetDoubleObjectiveThreshold.Since: 8.5
Arguments: - objectiveIndex (int) – Index of the objective.
- threshold (double) – Objective threshold.
See: See:
-
void
SetIntObjectiveThreshold(int objectiveIndex, long threshold)¶ Sets the threshold of the objective with the given index. If the objective is minimized (resp. maximized), then the optimization of this objective is stopped as soon as this lower (resp. upper) threshold is reached. It can be useful for goal programming. Only allowed in states
Stopped.Since: 8.5
Arguments: - objectiveIndex (int) – Index of the objective.
- threshold (long) – Objective threshold.
See: See:
-
void
SetDoubleObjectiveThreshold(int objectiveIndex, double threshold)¶ Sets the threshold of the objective with the given index. If the objective is minimized (resp. maximized), then the optimization of this objective is stopped as soon as this lower (resp. upper) threshold is reached. It can be useful for goal programming. Only allowed in states
Stopped.Since: 8.5
Arguments: - objectiveIndex (int) – Index of the objective.
- threshold (double) – Objective threshold.
See: See:
-
long
GetObjectiveThreshold(int objectiveIndex)¶ Gets the threshold of the objective with the given index. Only allowed in states
PausedorStopped.Since: 8.5 Arguments: objectiveIndex (int) – Index of the objective. Returns: Objective threshold. Return type: long See: HxParam.SetObjectiveThreshold(int, long)
-
long
GetIntObjectiveThreshold(int objectiveIndex)¶ Gets the threshold of the objective with the given index. Only allowed in states
PausedorStopped.Since: 8.5 Arguments: objectiveIndex (int) – Index of the objective. Returns: Objective threshold. Return type: long See: HxParam.SetIntObjectiveThreshold
-
double
GetDoubleObjectiveThreshold(int objectiveIndex)¶ Gets the threshold of the objective with the given index. Only allowed in states
PausedorStopped.Since: 8.5 Arguments: objectiveIndex (int) – Index of the objective. Returns: Objective threshold. Return type: double See: HxParam.SetDoubleObjectiveThreshold
-
void
SetAdvancedParam(string key, int value)¶ Reserved for maintenance purpose.
Sets the value of an advanced parameter. Advanced parameters are reserved for fine tuning or debugging and should not be used by end-users. Only allowed in states
ModelingorStopped.Arguments: - key – Name of the parameter.
- value – Value of the parameter.
-
int
GetAdvancedParam(string key)¶ Reserved for maintenance purpose.
Returns the value of an advanced parameter. Advanced parameters are reserved for fine tuning or debugging and should not be used by end-users. Throws an exception if the parameter does not exist.
Arguments: key – Name of the parameter. Returns: Value of the parameter. See: HxParam.SetAdvancedParam(string, int)
-
int
GetAdvancedParam(string key, int defaultValue) Reserved for maintenance purpose.
Returns the value of an advanced parameter. Advanced parameters are reserved for fine tuning or debugging and should not be used by end-users. The default value is returned if the parameter does not exist or if no value was set for this one.
Arguments: - key (string) – Name of the parameter.
- defaultValue (int) – Default value of the parameter.
See:
-
void
SetAdvancedParam(string key, double value) Reserved for maintenance purpose.
Sets the value of an advanced parameter. Advanced parameters are reserved for fine tuning or debugging and should not be used by end-users. Only allowed in states
ModelingorStopped.Arguments: - key – Name of the parameter.
- value – Value of the parameter.
-
double
GetAdvancedParam(string key, double defaultValue) Reserved for maintenance purpose.
Returns the value of an advanced parameter. Advanced parameters are reserved for fine tuning or debugging and should not be used by end-users. The default value is returned if the parameter does not exist or if no value was set for this one.
Arguments: - key (string) – Name of the parameter.
- defaultValue (double) – Default value of the parameter.
See:
-
void
SetAdvancedParam(string key, string value) Reserved for maintenance purpose.
Sets the value of an advanced parameter. Advanced parameters are reserved for fine tuning or debugging and should not be used by end-users. Only allowed in states
ModelingorStopped.Arguments: - key (string) – Name of the parameter.
- value (string) – Value of the parameter.
-
string
GetAdvancedParam(string key, string defaultValue) Reserved for maintenance purpose.
Returns the value of an advanced parameter. Advanced parameters are reserved for fine tuning or debugging and should not be used by end-users. The default value is returned if the parameter does not exist or if no value was set for this one.
Arguments: - key (string) – Name of the parameter.
- defaultValue (string) – Default value of the parameter.
See:
-
string
ToString()¶ Returns a string representation of these parameters. Useful for debugging or logging purposes.
Returns: String representation.