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

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

Functions
getDeclaredName Gets the name of the function.
call Calls the function with no argument and returns the result.
asValue Returns the function as an LSPValue.

Functions

std::string localsolver::modeler::LSPFunction::getDeclaredName()
const

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.

LSPValue localsolver::modeler::LSPFunction::call()

Calls the function with no argument and returns the result.

Return:Return value of the call.

LSPValue localsolver::modeler::LSPFunction::call(const std::vector<LSPValue> &arguments)

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

Return:Return value of the call.
Parameters:arguments - List of arguments.

LSPValue localsolver::modeler::LSPFunction::call(const LSPValue *arguments, int nbArguments)

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

Return:

Return value of the call.

Parameters:
  • arguments - Pointer to the first argument.
  • nbArguments - Number of arguments.

template <typename T>
LSPValue localsolver::modeler::LSPFunction::call(T begin, T end)

Calls the function with the provided arguments.

The arguments must be iterators referencing LSPValues.

Return:

Return value of the call.

Templates:

T - Type of an iterator referencing LSPValues.

Parameters:
  • begin - Iterator to the beginning of the arguments.
  • end - Iterator to the end of the arguments.

LSPValue localsolver::modeler::LSPFunction::asValue()
const

Returns the function as an LSPValue.

See:LSPValue