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 typeArgument
. 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 typeArgument
. 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 typeArgument
. 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 typeArgument
. 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 methodLSModel.CreateFunction
. This delegate must return an LSExpression that will be used as the body of your LocalSolver function.