LSExternalContext Class¶
- class
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 LocalSolver 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: LSExpression::getExternalContext() Since: 9.5
Summary¶
getIntLowerBound |
Gets the lower bound of the external function. |
getIntUpperBound |
Gets the upper bound of the external function. |
getDoubleLowerBound |
Gets the lower bound of the external function. |
getDoubleUpperBound |
Gets the upper bound of the external function. |
isNanable |
Returns true if the function can return a NaN (Not a Number) value. |
setLowerBound |
Sets the lower bound of the external function. |
setUpperBound |
Sets the upper bound of the external function. |
setIntLowerBound |
Sets the lower bound of the external function. |
setIntUpperBound |
Sets the upper bound of the external function. |
setDoubleLowerBound |
Sets the lower bound of the external function. |
setDoubleUpperBound |
Sets the upper bound of the external function. |
setNanable |
Sets whether or not the function can return a NaN (Not a Number) value. |
Functions¶
-
lsint
localsolver::LSExternalContext
::
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
.Return: Lower bound of the external function.
-
lsint
localsolver::LSExternalContext
::
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
.Return: Upper bound of the external function.
-
lsdouble
localsolver::LSExternalContext
::
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
.Return: Lower bound of the external function.
-
lsdouble
localsolver::LSExternalContext
::
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
.Return: Upper bound of the external function.
-
bool
localsolver::LSExternalContext
::
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.
Return: True if the function can return a NaN value.
-
void
localsolver::LSExternalContext
::
setLowerBound
(lsint lowerBound)¶ Sets the lower bound of the external function.
Only allowed if the external function is an integer function. Only allowed in state S_Modeling. This method has the same behaviour as LSExternalContext#setIntLowerBound(lsint)
Parameters: lowerBound - Lower bound of the function.
-
void
localsolver::LSExternalContext
::
setLowerBound
(lsdouble lowerBound)¶ Sets the lower bound of the external function.
Only allowed if the external function is a double function. Only allowed in state S_Modeling. This method has the same behaviour as LSExternalContext#setDoubleLowerBound(lsdouble)
Parameters: lowerBound - Lower bound of the function
-
void
localsolver::LSExternalContext
::
setUpperBound
(lsint upperBound)¶ Sets the upper bound of the external function.
Only allowed if the external function is an integer function. Only allowed in state S_Modeling. This method has the same behaviour as LSExternalContext#setIntUpperBound(lsint)
Parameters: upperBound - Upper bound of the function.
-
void
localsolver::LSExternalContext
::
setUpperBound
(lsdouble upperBound)¶ Sets the upper bound of the external function.
Only allowed if the external function is a double function. Only allowed in state S_Modeling. This method has the same behaviour as LSExternalContext#setDoubleLowerBound(lsdouble)
Parameters: upperBound - Upper bound of the function.
-
void
localsolver::LSExternalContext
::
setIntLowerBound
(lsint lowerBound)¶ Sets the lower bound of the external function.
Only allowed if the external function is an integer function.
Parameters: lowerBound - Lower bound of the function
-
void
localsolver::LSExternalContext
::
setIntUpperBound
(lsint upperBound)¶ Sets the upper bound of the external function.
Only allowed if the external function is an integer function. Only allowed in state S_Modeling.
Parameters: upperBound - Upper bound of the function.
-
void
localsolver::LSExternalContext
::
setDoubleLowerBound
(lsdouble lowerBound)¶ Sets the lower bound of the external function.
Only allowed if the external function is a double function.
Parameters: lowerBound - Lower bound of the function.
-
void
localsolver::LSExternalContext
::
setDoubleUpperBound
(lsdouble upperBound)¶ Sets the upper bound of the external function.
Only allowed if the external function is a double function. Only allowed in state S_Modeling.
Parameters: upperBound - Upper bound of the function.
-
void
localsolver::LSExternalContext
::
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. Only allowed in state S_Modeling.
Parameters: nanable - True if the function can return a NaN value, false otherwise.