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 long localsolver.LSIntBlackBoxFunction(LSBlackBoxArgumentValues argumentValues)

Integer black-box function delegate. To use integer black-box functions with LocalSolver, you have to proceed in 3 steps:

  1. Implement the delegate in a method. The method must take a LSBlackBoxArgumentValues and must return an integer 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).
  2. Instantiate the function as an LSExpression with LSModel.CreateIntBlackBoxFunction or the dedicated shortcut LSModel.IntBlackBoxFunction.
  3. Pass arguments to 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 the LSBlackBoxArgumentValues.

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 (see LSExpression.GetBlackBoxContext).

Since:10.0
See:LSModel.CreateIntBlackBoxFunction
See:LSOperator.Call
See:LSOperator.BlackBoxFunction
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:

  1. 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).
  2. Instantiate the function as an LSExpression with LSModel.CreateDoubleBlackBoxFunction or the dedicated shortcut LSModel.DoubleBlackBoxFunction.
  3. Pass arguments to 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 the LSBlackBoxArgumentValues.

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 (see LSExpression.GetBlackBoxContext).

See:LSModel.CreateDoubleBlackBoxFunction
See:LSOperator.Call
See:LSOperator.BlackBoxFunction