This page is for an old version of Hexaly Optimizer.
We recommend that you update your version and read the documentation for the
latest stable release.
LSBlackBoxFunction Delegate¶
-
delegate double
localsolver.
LSDoubleBlackBoxFunction
(LSBlackBoxArgumentValues argumentValues)¶ Double black-box function delegate. To use double black-box functions with LocalSolver, you have to proceed in 3 steps:
- Implement the delegate in a method. The method must take a
LSBlackBoxArgumentValues
and must return a double value. The argument values contain the values of the expressions passed to the function. A distinction is made between integer arguments (bool, int) and floating point arguments (double). - Instantiate the function as an LSExpression with
LSModel.CreateDoubleBlackBoxFunction
or the dedicated shortcutLSModel.DoubleBlackBoxFunction
. - Pass arguments ot your function and call it. For that, you have to
create expressions of type
LSOperator.Call
. The first operand must be the LSExpression corresponding to your black-box function. The other operands must be LSExpressions that will be used as arguments. Their value will be made accessible to your black-box function through theLSBlackBoxArgumentValues
.
Note: You can provide additional data for your function (such as bounds or the maximum number of evaluations) with the help of the
LSBlackBoxContext
associated with your function (seeLSExpression.GetBlackBoxContext
).See: LSModel.CreateDoubleBlackBoxFunction See: LSOperator.Call See: LSOperator.BlackBoxFunction - Implement the delegate in a method. The method must take a