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.

LSPFunction Class

class localsolver.modeler.LSPFunction

A function can be either a user-defined function or a built-in function. It is possible to create external functions from the modeler API and call them in the modeler. See LSPFunctor for more information on how to create external functions.

See:LSPFunctor
Since:10.0

Summary

Methods
GetDeclaredName Gets the name of the function.
Call Calls the function with no argument and returns the result.
AsValue Gets the function as an LSPValue.
Dispose Releases the reference.

Instance methods

string GetDeclaredName()

Gets the name of the function. The name of the function does not necessarily reflect the name of the variable(s) to which the function is associated. The name is mainly used to identify the function in stack traces when exceptions occur.

Returns:Name of the function.
Return type:string
LSPValue Call()

Calls the function with no argument and returns the result.

Returns:Return value of the call.
Return type:LSPValue
LSPValue Call(params LSPValue[] arguments)
LSPValue Call(List<LSPValue> arguments)

Calls the function with the provided arguments and returns the result.

Arguments:arguments – List of arguments.
Returns:Return value of the call.
Return type:LSPValue
LSPValue AsValue()

Gets the function as an LSPValue.

Return type:LSPValue
void Dispose()

Releases the reference. If this function was already released, returns immediately and does nothing. Invoking any method on this object after this operation will throw an exception.

Note: Releasing a reference does not necessarily imply that the underlying function object is destroyed. It is only destroyed if no more references point to it.

Since:11.5