HxExternalContext Class¶
-
class HxExternalContext¶
Context of an external function. External contexts can be used to query and set properties of the associated external function.
If you known the bounds of the external function or if you know it cannot return a NaN value, we recommend you to specify it as Hexaly Optimizer is then able to improve its search process. But beware! If the evaluation of the function returns an unexpected value (like a value outside of the bounds), an exception will be thrown during the search.
- See:
- Since:
9.5
Summary¶
Gets the lower bound of the external function. |
|
Gets the upper bound of the external function. |
|
Gets the lower bound of the external function. |
|
Gets the upper bound of the external function. |
|
Returns true if the function can return a NaN (Not a Number) value. |
|
Sets the lower bound of the external function. |
|
Sets the lower bound of the external function. |
|
Sets the upper bound of the external function. |
|
Sets the upper bound of the external function. |
|
Sets the lower bound of the external function. |
|
Sets the upper bound of the external function. |
|
Sets the lower bound of the external function. |
|
Sets the upper bound of the external function. |
|
Sets whether or not the function can return a NaN (Not a Number) value. |
|
Enables the surrogate modeling on the associated external function. |
Functions¶
-
hxint HxExternalContext::getIntLowerBound() const¶
Gets the lower bound of the external function. Only allowed if the external function is an integer function. By default, this property is set to
LONG_LONG_MIN
.- Returns:
Lower bound of the external function.
-
hxint HxExternalContext::getIntUpperBound() const¶
Gets the upper bound of the external function. Only allowed if the external function is an integer function. By default, this property is set to
LONG_LONG_MAX
.- Returns:
Upper bound of the external function.
-
hxdouble HxExternalContext::getDoubleLowerBound() const¶
Gets the lower bound of the external function. Only allowed if the external function is a double function. By default, this property is set to
-INFINITY
.- Returns:
Lower bound of the external function.
-
hxdouble HxExternalContext::getDoubleUpperBound() const¶
Gets the upper bound of the external function. Only allowed if the external function is a double function. By default, this property is set to
INFINITY
.- Returns:
Upper bound of the external function.
-
bool HxExternalContext::isNanable() const¶
Returns true if the function can return a NaN (Not a Number) value. Only allowed if the external function is a double function. By default this property is set to true.
- Returns:
True if the function can return a NaN value.
-
void HxExternalContext::setLowerBound(hxint lowerBound)¶
Sets the lower bound of the external function. Only allowed if the external function is an integer function. If it is an array function, the bound will apply to all elements of the array. Only allowed in state
S_Modeling
. This method has the same behaviour asHxExternalContext::setIntLowerBound()
- Parameters:
lowerBound – Lower bound of the function.
-
void HxExternalContext::setLowerBound(hxdouble lowerBound)¶
Sets the lower bound of the external function. Only allowed if the external function is a double function. If it is an array function, the bound will apply to all elements of the array. Only allowed in state
S_Modeling
. This method has the same behaviour asHxExternalContext::setDoubleLowerBound()
- Parameters:
lowerBound – Lower bound of the function
-
void HxExternalContext::setUpperBound(hxint upperBound)¶
Sets the upper bound of the external function. Only allowed if the external function is an integer function. If it is an array function, the bound will apply to all elements of the array. Only allowed in state
S_Modeling
. This method has the same behaviour asHxExternalContext::setIntUpperBound()
- Parameters:
upperBound – Upper bound of the function.
-
void HxExternalContext::setUpperBound(hxdouble upperBound)¶
Sets the upper bound of the external function. Only allowed if the external function is a double function. If it is an array function, the bound will apply to all elements of the array. Only allowed in state
S_Modeling
. This method has the same behaviour asHxExternalContext::setDoubleLowerBound()
- Parameters:
upperBound – Upper bound of the function.
-
void HxExternalContext::setIntLowerBound(hxint lowerBound)¶
Sets the lower bound of the external function. Only allowed if the external function is an integer function. If it is an array function, the bound will apply to all elements of the array. Only allowed in state
S_Modeling
.- Parameters:
lowerBound – Lower bound of the function
-
void HxExternalContext::setIntUpperBound(hxint upperBound)¶
Sets the upper bound of the external function. Only allowed if the external function is an integer function. If it is an array function, the bound will apply to all elements of the array. Only allowed in state
S_Modeling
.- Parameters:
upperBound – Upper bound of the function.
-
void HxExternalContext::setDoubleLowerBound(hxdouble lowerBound)¶
Sets the lower bound of the external function. Only allowed if the external function is a double function. If it is an array function, the bound will apply to all elements of the array. Only allowed in state
S_Modeling
.- Parameters:
lowerBound – Lower bound of the function.
-
void HxExternalContext::setDoubleUpperBound(hxdouble upperBound)¶
Sets the upper bound of the external function. Only allowed if the external function is a double function. If it is an array function, the bound will apply to all elements of the array. Only allowed in state
S_Modeling
.- Parameters:
upperBound – Upper bound of the function.
-
void HxExternalContext::setNanable(bool nanable)¶
Sets whether or not the function can return a NaN (Not a Number) value. Only allowed if the external function is a double function. If it is an array function, this parameter will apply to all elements of the array. Only allowed in state
S_Modeling
.- Parameters:
nanable – True if the function can return a NaN value, false otherwise.
-
HxSurrogateParameters HxExternalContext::enableSurrogateModeling()¶
Enables the surrogate modeling on the associated external function. This method changes the internal behavior of the optimizer: the optimizer now considers that the function is computationally expensive and therefore uses surrogate modeling. This method returns the
HxSurrogateParameters
which are used to parameterize various aspects of surrogate modeling. Note: Once the surrogate modeling is enabled, it cannot be disabled. Only allowed in stateS_Modeling
.For more information, please see the section dedicated to surrogate modeling among the modeling features.
- Returns:
Surrogate parameters.
- Rtype: