LocalSolver logo
is now
Hexaly logo

We're excited to share that we are moving forward. We're leaving behind the LocalSolver brand and transitioning to our new identity: Hexaly. This represents a leap forward in our mission to enable every organization to make better decisions faster when faced with operational and strategic challenges.

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.

LSFunction Delegate

Function delegates. These particular delegates are used to instanciate Function in LocalSolver.

A function is a particular LSExpression composed of two parts:

  • The arguments of the function (which are also LSExpression of type Argument).
  • The body of the function. The body is an LSExpression that will be used to evaluate the result of the function. The body can be any LSExpression composed of any operands and operators supported by LocalSolver.

The following delegates are used by the method LSModel.CreateFunction to instanciate very easily, in one declaration, the arguments and the body of the LocalSolver function.

since:7.0
delegate LSExpression localsolver.LSFunction0()

Delegate used to create a function without argument. This delegate can be used with the method LSModel.CreateFunction. In that case, your delegate will be called once, without argument. It must return an LSExpression that will be used as the body of your LocalSolver function.

delegate LSExpression localsolver.LSFunction1(LSExpression a)

Delegate used to create a function with one argument. This delegate can be used with the method LSModel.CreateFunction. In that case, your delegate will be called once, with one LSExpression of type Argument. It must return an LSExpression that will be used as the body of your LocalSolver function.

delegate LSExpression localsolver.LSFunction2(LSExpression a, LSExpression b)

Delegate used to create a function with two arguments. This delegate can be used with the method LSModel.CreateFunction. In that case, your delegate will be called once, with two LSExpression of type Argument. It must return an LSExpression that will be used as the body of your LocalSolver function.

delegate LSExpression localsolver.LSFunction3(LSExpression a, LSExpression b, LSExpression c)

Delegate used to create a function with three arguments. This delegate can be used with the method LSModel.CreateFunction. In that case, your delegate will be called once, with three LSExpression of type Argument. It must return an LSExpression that will be used as the body of your LocalSolver function.

delegate LSExpression localsolver.LSFunction(LSExpression[] arguments)

Delegate used to create a function with arguments. This delegate can be used with the method LSModel.CreateFunction. In that case, your delegate will be called once, with an array of LSExpression of type Argument. The size of the array will depend on the number of arguments you want for your function. The number of arguments is specified when you call the method LSModel.CreateFunction. This delegate must return an LSExpression that will be used as the body of your LocalSolver function.