Package com.hexaly.optimizer
Class HxParam
java.lang.Object
com.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.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanintgetAdvancedParam(String key) Returns the value of an advanced parameter.doublegetAdvancedParam(String key, double defaultValue) Reserved for maintenance purpose.intgetAdvancedParam(String key, int defaultValue) Reserved for maintenance purpose.getAdvancedParam(String key, String defaultValue) Reserved for maintenance purpose.doublegetDoubleObjectiveThreshold(int objectiveIndex) Gets the threshold of the objective with the given index.longgetIntObjectiveThreshold(int objectiveIndex) Gets the threshold of the objective with the given index.longGets the number of iterations between two events of typeHxCallbackType.IterationTicked.longGets the maximum number of iterations.Returns the path of the Hexaly Optimizer log file.Returns the stream used by Hexaly Optimizer for its logging.intGets the number of displayed objectives.intGets the maximum number of violated constraints to display.intGets the number of threads (0 coding for automatic setting).longgetObjectiveThreshold(int objectiveIndex) Gets the threshold of the objective with the given index.Returns the Hexaly Optimizer object associated to these parameters.intgetSeed()Gets the seed of the pseudo-random number generator used by the optimizer.intGets the time in seconds between two consecutive displays in console while the optimizer is running.intGets the time in seconds between two events of typeHxCallbackType.TimeTicked.intGets the time limit in seconds.intGets the verbosity level of the optimizer.intGets the warning level.inthashCode()voidsetAdvancedParam(String key, double value) Reserved for maintenance purpose.voidsetAdvancedParam(String key, int value) Sets the value of an advanced parameter.voidsetAdvancedParam(String key, String value) Reserved for maintenance purpose.voidsetDoubleObjectiveThreshold(int objectiveIndex, double threshold) Sets the threshold of the objective with the given index.voidsetIntObjectiveThreshold(int objectiveIndex, long threshold) Sets the threshold of the objective with the given index.voidsetIterationBetweenTicks(long iterationBetweenTicks) Sets the number of iterations between two events of typeHxCallbackType.IterationTicked.voidsetIterationLimit(long iterationLimit) Sets the maximum number of iterations.voidsetLogFile(String path) Sets the path of the Hexaly Optimizer log file.voidsetLogWriter(PrintStream stream) Sets the stream used by Hexaly Optimizer for its logging.voidsetNbDisplayedObjectives(int nbDisplayedObjectives) Sets the number of displayed objectives.voidsetNbDisplayedViolatedConstraints(int nbDisplayedViolatedConstraints) Sets the maximum number of violated constraints to display.voidsetNbThreads(int nbThreads) Sets the number of threads used to parallelize the search.voidsetObjectiveThreshold(int objectiveIndex, double threshold) Sets the threshold of the objective with the given index.voidsetObjectiveThreshold(int objectiveIndex, long threshold) Sets the threshold of the objective with the given index.voidsetSeed(int seed) Sets the seed of the pseudo-random number generator used by the optimizer.voidsetTimeBetweenDisplays(int timeBetweenDisplays) Sets the time in seconds between two consecutive displays in console while the optimizer is running.voidsetTimeBetweenTicks(int timeBetweenTicks) Sets the time in seconds between two events of typeHxCallbackType.TimeTicked.voidsetTimeLimit(int timeLimit) Sets the time limit in seconds.voidsetVerbosity(int verbosity) Sets the verbosity level of the optimizer.voidsetWarningLevel(int warningLevel) Sets the warning level.toString()Returns a String representation of these parameters.
-
Method Details
-
getOptimizer
Returns the Hexaly Optimizer object associated to these parameters.- Returns:
- Hexaly Optimizer object.
-
setSeed
public void 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 statesHxState.ModelingorHxState.Stopped.- Parameters:
seed- Seed of the pseudo-random number generator.
-
getSeed
public int getSeed()Gets the seed of the pseudo-random number generator used by the optimizer.- Returns:
- Seed of the pseudo-random number generator.
- See Also:
-
setNbThreads
public 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 statesHxState.ModelingorHxState.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.
-
getNbThreads
public int getNbThreads()Gets the number of threads (0 coding for automatic setting).- Returns:
- Number of threads.
- See Also:
-
setNbDisplayedObjectives
public void setNbDisplayedObjectives(int nbDisplayedObjectives) Sets the number of displayed objectives. Only allowed in statesHxState.ModelingorHxState.Stopped.- Parameters:
nbDisplayedObjectives- Number of displayed objectives.
-
getNbDisplayedObjectives
public int getNbDisplayedObjectives()Gets the number of displayed objectives.- Returns:
- Number of displayed objectives.
- See Also:
-
setNbDisplayedViolatedConstraints
public void setNbDisplayedViolatedConstraints(int nbDisplayedViolatedConstraints) Sets the maximum number of violated constraints to display. Only allowed in statesHxState.ModelingorHxState.Stopped.- Parameters:
nbDisplayedViolatedConstraints- Maximum number of violated constraints to display.
-
getNbDisplayedViolatedConstraints
public int getNbDisplayedViolatedConstraints()Gets the maximum number of violated constraints to display.- Returns:
- Maximum number of violated constraints to display.
- See Also:
-
setWarningLevel
public void setWarningLevel(int warningLevel) Sets the warning level. Only allowed in statesHxState.ModelingorHxState.Stopped.- Parameters:
warningLevel- Warning level.
-
getWarningLevel
public int getWarningLevel()Gets the warning level.- Returns:
- Warning level.
- See Also:
-
setTimeLimit
public void setTimeLimit(int timeLimit) Sets the time limit in seconds. Only allowed in statesHxState.ModelingorHxState.Stopped.- Parameters:
timeLimit- Time limit in seconds.- See Also:
-
getTimeLimit
public int getTimeLimit()Gets the time limit in seconds.- Returns:
- Time limit in seconds.
- See Also:
-
setIterationLimit
public void setIterationLimit(long iterationLimit) Sets the maximum number of iterations.- Parameters:
iterationLimit- Iteration limit.- See Also:
-
getIterationLimit
public long getIterationLimit()Gets the maximum number of iterations.- Returns:
- Iteration limit.
- See Also:
-
setVerbosity
public void setVerbosity(int verbosity) Sets the verbosity level of the optimizer. The default verbosity is set to 1. 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.
HxState.ModelingorHxState.Stopped.- Parameters:
verbosity- Verbosity level: 0, 1, 2.
-
getVerbosity
public int getVerbosity()Gets the verbosity level of the optimizer.- Returns:
- verbosity Verbosity level: 0, 1 or 2.
- See Also:
-
setTimeBetweenDisplays
public void 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 statesHxState.ModelingorHxState.Stopped.- Parameters:
timeBetweenDisplays- Time in seconds between displays.
-
getTimeBetweenDisplays
public int getTimeBetweenDisplays()Gets the time in seconds between two consecutive displays in console while the optimizer is running.- Returns:
- Time in seconds between displays.
- See Also:
-
setTimeBetweenTicks
public void setTimeBetweenTicks(int timeBetweenTicks) Sets the time in seconds between two events of typeHxCallbackType.TimeTicked. The default time between ticks is set to 1 second. Only allowed in statesHxState.ModelingorHxState.Stopped.- Parameters:
timeBetweenTicks- Time in seconds between ticks.- Since:
- 6.0
-
getTimeBetweenTicks
public int getTimeBetweenTicks()Gets the time in seconds between two events of typeHxCallbackType.TimeTicked.- Returns:
- Time in seconds between ticks.
- Since:
- 6.0
- See Also:
-
setIterationBetweenTicks
public void setIterationBetweenTicks(long iterationBetweenTicks) Sets the number of iterations between two events of typeHxCallbackType.IterationTicked. The default number of iterations between ticks is set to 10,000. Only allowed in statesHxState.ModelingorHxState.Stopped.- Parameters:
iterationBetweenTicks- Number of iterations between ticks.- Since:
- 6.0
-
getIterationBetweenTicks
public long getIterationBetweenTicks()Gets the number of iterations between two events of typeHxCallbackType.IterationTicked.- Returns:
- Number of iterations between ticks.
- Since:
- 6.0
- See Also:
-
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 Also:
-
setLogFile
Sets the path of the Hexaly Optimizer log file. The log file is used to duplicate the standard output of Hexaly Optimizer. If the specified path is empty or null, no log file will be used. To tune the logging verbosity of the output, seesetVerbosity(int). The verbosity is common to both the standard output and the log file. Only allowed in statesHxState.StoppedorHxState.Modeling.- Parameters:
path- Path of the log file. Leave empty to disable the logging mechanism.- See Also:
-
setLogWriter
Sets the stream used by Hexaly Optimizer for its logging. The default is to log to the standard output. To tune the logging verbosity of the output, seesetVerbosity(int). Note that you can specify both the log writer and the log file by using the methodsetLogFile(java.lang.String).- Parameters:
stream- Stream to use for the logging or null to disable logging.- Since:
- 9.5
-
getLogWriter
Returns the stream used by Hexaly Optimizer for its logging. The default value is initialized to the standard output, retrieved withSystem.out. To tune the logging verbosity of the output, seesetVerbosity(int).- Returns:
- The stream used by Hexaly Optimizer for its logging or null if logging is disabled.
- Since:
- 9.5
- See Also:
-
setObjectiveThreshold
public 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 statesHxState.Stopped. This method has the same behavior assetIntObjectiveThreshold(int, long).- Parameters:
objectiveIndex- Index of the objective.threshold- Objective threshold.- Since:
- 8.5
- See Also:
-
setObjectiveThreshold
public 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 statesHxState.Stopped. This method has the same behavior assetDoubleObjectiveThreshold(int, double).- Parameters:
objectiveIndex- Index of the objective.threshold- Objective threshold.- Since:
- 8.5
- See Also:
-
setIntObjectiveThreshold
public 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 statesHxState.Stopped.- Parameters:
objectiveIndex- Index of the objective.threshold- Objective threshold.- Since:
- 8.5
- See Also:
-
setDoubleObjectiveThreshold
public 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 statesHxState.Stopped.- Parameters:
objectiveIndex- Index of the objective.threshold- Objective threshold.- Since:
- 8.5
- See Also:
-
getObjectiveThreshold
public long getObjectiveThreshold(int objectiveIndex) Gets the threshold of the objective with the given index. Only allowed in statesHxState.PausedorHxState.Stopped.- Parameters:
objectiveIndex- Index of the objective.- Returns:
- Objective threshold.
- Since:
- 8.5
- See Also:
-
getIntObjectiveThreshold
public long getIntObjectiveThreshold(int objectiveIndex) Gets the threshold of the objective with the given index. Only allowed in statesHxState.PausedorHxState.Stopped.- Parameters:
objectiveIndex- Index of the objective.- Returns:
- Objective threshold.
- Since:
- 8.5
- See Also:
-
getDoubleObjectiveThreshold
public double getDoubleObjectiveThreshold(int objectiveIndex) Gets the threshold of the objective with the given index. Only allowed in statesHxState.PausedorHxState.Stopped.- Parameters:
objectiveIndex- Index of the objective.- Returns:
- Objective threshold.
- Since:
- 8.5
- See Also:
-
setAdvancedParam
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 statesHxState.ModelingorHxState.Stopped.- Parameters:
key- Name of the parameter.value- Value of the parameter.
-
getAdvancedParam
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 Also:
-
getAdvancedParam
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.- Parameters:
key- Name of the parameter.defaultValue- Default value of the parameter.- See Also:
-
setAdvancedParam
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 statesHxState.ModelingorHxState.Stopped.- Parameters:
key- Name of the parameter.value- Value of the parameter.
-
getAdvancedParam
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.- Parameters:
key- Name of the parameter.defaultValue- Default value of the parameter.- See Also:
-
setAdvancedParam
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 statesHxState.ModelingorHxState.Stopped.- Parameters:
key- Name of the parameter.value- Value of the parameter.
-
getAdvancedParam
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.- Parameters:
key- Name of the parameter.defaultValue- Default value of the parameter.- See Also:
-
toString
Returns a String representation of these parameters. Useful for debugging or logging purposes. -
hashCode
public int hashCode() -
equals
-