HxParam Class¶
-
class 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¶
Sets the seed of the pseudo-random number generator used by the optimizer. |
|
Gets the seed of the pseudo-random number generator used by the optimizer. |
|
Sets the number of threads used to parallelize the search. |
|
Gets the number of threads requested by the user. |
|
Sets the time limit in seconds. |
|
Gets the time limit in seconds. |
|
Sets the maximum number of iterations. |
|
Gets the maximum number of iterations. |
|
Deprecated since version 8.5: This parameter does not have a significant influence on the search anymore. |
|
Deprecated since version 8.5: This parameter does not have a significant influence on the search anymore. |
|
Sets the verbosity level of the optimizer. |
|
Gets the verbosity level of the optimizer. |
|
Sets the threshold of the objective with the given index. |
|
Sets the threshold of the objective with the given index. |
|
Sets the threshold of the objective with the given index. |
|
Sets the threshold of the objective with the given index. |
|
Gets the threshold of the objective with the given index. |
|
Gets the threshold of the objective with the given index. |
|
Gets the threshold of the objective with the given index. |
|
Sets the time in seconds between two consecutive displays in console while the optimizer is running. |
|
Gets the time in seconds between two consecutive displays in console while the optimizer is running. |
|
Sets the time in seconds between two events of type CT_TimeTicked. |
|
Gets the time in seconds between two events of type CT_TimeTicked. |
|
Sets the number of iterations between two events of type CT_IterationTicked. |
|
Gets the number of iterations between two events of type CT_IterationTicked. |
|
Sets the writer used by Hexaly Optimizer for its logging. |
|
Returns the writer used by Hexaly Optimizer for its logging. |
|
Sets the path of the Hexaly Optimizer log file. |
|
Returns the path of the Hexaly Optimizer log file. |
|
Sets the value of an advanced parameter. |
|
Sets the value of an advanced parameter. |
|
Sets the value of an advanced parameter. |
|
Returns the value of an advanced parameter. |
|
Returns the value of an advanced parameter. |
|
Returns the value of an advanced parameter. |
|
Returns the value of an advanced parameter. |
|
Returns a string representation of these parameters. |
Functions¶
-
void HxParam::setSeed(int seed)¶
Sets the seed of the pseudo-random number generator used by the optimizer. The seed must be a positive integer. The default seed is set to 0. Only allowed in states
S_Modeling
orS_Stopped
.- Parameters:
seed – Seed of the pseudo-random number generator.
-
int HxParam::getSeed() const¶
Gets the seed of the pseudo-random number generator used by the optimizer.
- Returns:
Seed of the pseudo-random number generator.
- See:
-
void HxParam::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. Only allowed in states
S_Modeling
orS_Stopped
. This parameter is indicative, if needed Hexaly Optimizer may use more threads. The actual number of threads can also vary during the search.- Parameters:
nbThreads – Number of threads.
-
int HxParam::getNbThreads() const¶
Gets the number of threads requested by the user.
- Returns:
Number of threads (by convention, 0 means that the number of threads is automatically adapted to your computer and to your optimization model).
- See:
-
void HxParam::setTimeLimit(int timeLimit)¶
Sets the time limit in seconds. Only allowed in states
S_Modeling
orS_Stopped
.- Parameters:
timeLimit – Time limit in seconds.
- See:
-
int HxParam::getTimeLimit()¶
Gets the time limit in seconds.
- Returns:
Time limit in seconds.
- See:
- See:
-
void HxParam::setIterationLimit(long long iterationLimit)¶
Sets the maximum number of iterations. Only allowed in states
S_Modeling
orS_Stopped
.- Parameters:
iterationLimit – Iteration limit.
- See:
-
long long HxParam::getIterationLimit()¶
Gets the maximum number of iterations.
- Returns:
Iteration limit.
- See:
- See:
-
void HxParam::setAnnealingLevel(int annealingLevel)¶
Deprecated since version 8.5: This parameter does not have a significant influence on the search anymore. The tuning of this parameter won’t be allowed in a future version.
Sets the simulated annealing level. The level must be an integer between 0 and 9. The default simulated annealing level is set to 1. Only allowed in states
S_Modeling
orS_Stopped
.- Parameters:
annealingLevel – Simulated annealing level.
-
int HxParam::getAnnealingLevel() const¶
Deprecated since version 8.5: This parameter does not have a significant influence on the search anymore. The tuning of this parameter won’t be allowed in a future version.
Gets the simulated annealing level.
- Returns:
Simulated annealing level.
- See:
-
void HxParam::setVerbosity(int verbosity)¶
Sets the verbosity level of the optimizer. The default verbosity is set to 1. Only allowed in states
S_Modeling
orS_Stopped
. 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.
- Parameters:
verbosity – Verbosity level: 0, 1, 2.
-
int HxParam::getVerbosity() const¶
Gets the verbosity level of the optimizer.
- Returns:
verbosity Verbosity level: 0, 1 or 2.
- See:
-
void HxParam::setObjectiveThreshold(int objectiveIndex, hxint 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 state
S_Stopped
. This method has the same behavior asHxParam::setIntObjectiveThreshold()
.- Parameters:
objectiveIndex – Index of the objective.
threshold – Objective threshold.
- See:
- See:
- Since:
8.5
-
void HxParam::setObjectiveThreshold(int objectiveIndex, hxdouble 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 state
S_Stopped
. This method has the same behavior asHxParam::setDoubleObjectiveThreshold()
.- Parameters:
objectiveIndex – Index of the objective.
threshold – Objective threshold.
- See:
- See:
- Since:
8.5
-
void HxParam::setIntObjectiveThreshold(int objectiveIndex, hxint 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 state
S_Stopped
.- Parameters:
objectiveIndex – Index of the objective.
threshold – Objective threshold.
- See:
- See:
- Since:
8.5
-
void HxParam::setDoubleObjectiveThreshold(int objectiveIndex, hxdouble 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 state
S_Stopped
.- Parameters:
objectiveIndex – Index of the objective.
threshold – Objective threshold.
- See:
- See:
- Since:
8.5
-
hxint HxParam::getObjectiveThreshold(int objectiveIndex) const¶
Gets the threshold of the objective with the given index. Only allowed in states
S_Paused
orS_Stopped
.- Parameters:
objectiveIndex – Index of the objective.
- Returns:
Objective threshold.
- See:
- Since:
8.5
-
hxint HxParam::getIntObjectiveThreshold(int objectiveIndex) const¶
Gets the threshold of the objective with the given index. Only allowed in states
S_Paused
orS_Stopped
.- Parameters:
objectiveIndex – Index of the objective.
- Returns:
Objective threshold.
- See:
- Since:
8.5
-
hxdouble HxParam::getDoubleObjectiveThreshold(int objectiveIndex) const¶
Gets the threshold of the objective with the given index. Only allowed in states
S_Paused
orS_Stopped
.- Parameters:
objectiveIndex – Index of the objective.
- Returns:
Objective threshold.
- See:
- Since:
3.0
-
void HxParam::setTimeBetweenDisplays(int timeBetweenDisplays)¶
Sets the time in seconds between two consecutive displays in console while the optimizer is running. The default time between displays is set to 1 second. Only allowed in states
S_Modeling
orS_Stopped
.- Parameters:
timeBetweenDisplays – Time in seconds between displays.
-
int HxParam::getTimeBetweenDisplays() const¶
Gets the time in seconds between two consecutive displays in console while the optimizer is running.
- Returns:
Time in seconds between displays.
- See:
-
void HxParam::setTimeBetweenTicks(int timeBetweenTicks)¶
Sets the time in seconds between two events of type
CT_TimeTicked
. The default time between ticks is set to 1 second. Only allowed in statesS_Modeling
orS_Stopped
.- Parameters:
timeBetweenTicks – Time in seconds between ticks.
- Since:
6.0
-
int HxParam::getTimeBetweenTicks() const¶
Gets the time in seconds between two events of type
CT_TimeTicked
.- Returns:
Time in seconds between ticks.
- See:
- Since:
6.0
-
void HxParam::setIterationBetweenTicks(long long iterationBetweenTicks)¶
Sets the number of iterations between two events of type
CT_IterationTicked
. The default number of iterations between ticks is set to 10,000. Only allowed in statesS_Modeling
orS_Stopped
.- Parameters:
iterationBetweenTicks – Number of iterations between ticks.
- Since:
6.0
-
long long HxParam::getIterationBetweenTicks() const¶
Gets the number of iterations between two events of type
CT_IterationTicked
.- Returns:
Number of iterations between ticks.
- See:
- Since:
6.0
-
void HxParam::setLogWriter(std::streambuf *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 or to disable logging, see
HxParam::setVerbosity()
. Note that you can specify both the log writer and the log file by using the methodHxParam::setLogFile()
.- Parameters:
writer – Writer to use for the logging or null to restore the default writer.
- Since:
9.5
-
std::streambuf *HxParam::getLogWriter() const¶
Returns the writer used by Hexaly Optimizer for its logging. The default value is null and means “logging to the standard output”. To tune the logging verbosity of the output or to disable logging, see
HxParam::setVerbosity()
.- Returns:
The writer used by Hexaly Optimizer for its logging.
- See:
- Since:
9.5
-
void HxParam::setLogFile(const std::string &path)¶
Sets the path of the Hexaly Optimizer log file. If the path is empty, no log wil be saved. To tune the logging verbosity, see
HxParam::setVerbosity()
. Only allowed in statesS_Modeling
orS_Stopped
.- Parameters:
path – Path of the log file. Leave empty to disable the logging mechanism.
- See:
- See:
-
std::string HxParam::getLogFile() const¶
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:
-
void HxParam::setAdvancedParam(const std::string &key, int value)¶
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
S_Modeling
orS_Stopped
.- Parameters:
key – Name of the parameter.
value – Value of the parameter.
-
void HxParam::setAdvancedParam(const std::string &key, double value)¶
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
S_Modeling
orS_Stopped
.- Parameters:
key – Name of the parameter.
value – Value of the parameter.
-
void HxParam::setAdvancedParam(const std::string &key, const std::string &value)¶
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
S_Modeling
orS_Stopped
.- Parameters:
key – Name of the parameter.
value – Value of the parameter.
-
int HxParam::getAdvancedParam(const std::string &key) const¶
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.
- Parameters:
key – Name of the parameter.
- Returns:
Value of the parameter.
- See:
-
int HxParam::getAdvancedParam(const std::string &key, int defaultValue) const¶
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 is defined for this parameter.
- Parameters:
key – Name of the parameter.
defaultValue – Default value.
- See:
-
double HxParam::getAdvancedParam(const std::string &key, double defaultValue) const¶
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 is defined for this parameter.
- Parameters:
key – Name of the parameter.
defaultValue – Default value.
- See:
-
std::string HxParam::getAdvancedParam(const std::string &key, const std::string &defaultValue) const¶
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 is defined for this parameter.
- Parameters:
key – Name of the parameter.
defaultValue – Default value of the parameter.
- See: