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.

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 modeler function from the modeler API and call them in the modeler. See LSPModeler.create_function() for more information on how to create external functions.

Since

10.0

Summary

Attributes

name

Returns the name of the function.

Methods

get_name

Returns the name of the function.

Special methods

__call__

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

Instance methods

LSPFunction.get_name()

Returns 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

The name of the function.

Return type

str

Instance attributes

LSPFunction.name

Returns the name of the function. This is a shortcut for LSPFunction.get_name().

Special operators and methods

LSPFunction.__call__(\*args)

Calls the function with the provided arguments and returns the result. The arguments must be of the following types:

Parameters

args – List of arguments passed to the function.

Returns

Return value of the call.

Return type

one of the supported type among NoneType (nil in LSP), int, float, bool, str, LSExpression, LSPFunction, LSPModule, LSPMap