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.

LocalSolver 9.5

Caution

This update introduces a number of breaking changes in the APIs.

Release notes

  • Native functions have been replaced by external functions which offer additional functionalities.

  • The black-box API has been merged with the rest of the LocalSolver API and offers additional functionalities.

  • LocalSolver functions have been renamed lambda functions.

  • The solver API has been extended to support custom log writers.

External Functions

Native functions have been replaced by external functions. With this change comes the ability to specify the return type of your function (integer or double) which can help the solver better perform for your particular problem.

Native contexts have been replaced by external argument values which serve the same purpose of carrying the values of the arguments passed to the external function.

You can now provide additional data for your external function: a lower bound, an upper bound, and whether or not the function may return a NaN value. This is made possible thanks to the external context associated with your function. This too can help the solver with performance but you must be careful about the data your provide. If a function returns an unexpected value, the solver will throw an exception.

For more details about external functions, please check out the section on external functions in the advanced features.

Black-box optimization

Black-box functions were previously contained to their own black-box API but have now been merged with the rest of LocalSolver’s API. While this does not mean any functional change for now, we aim to integrate most of LocalSolver features with the black-box optimization process in the future.

As with external functions, what was known as the black-box native context has been replaced by black-box argument values. The new black-box context, can now be used to provide data for your function (bounds and whether or not the function may return a NaN value). It can also be used to parameterize the optimization process by setting a maximum number of calls to the optimized function.

When a model contains a black-box function, LocalSolver will automatically make use of its black-box optimization solver.

Note that only the following operators are allowed in a black-box model: bool, integers and float variables, as well as constants and black-box functions.

For more details about black-box functions, please check out the section on black-box optimization in the advanced features.

Lambda Functions

To avoid any confusions with external and black-box functions, what was known as functions in LocalSolver has been renamed to lambda functions. Unfortunately, this means that all models making use of this type of expression must be updated to work with LocalSolver 9.5.

API Changes

LSP

  • Replaced the built-in method nativeFunction() by intExternalFunction() and doubleExternalFunction(). These methods enable you to specify the return type of the function when it is added to the model.

  • The context of the function can be accessed by addressing the context field of the function expression.

Python

C++

C#

Java

  • Replaced the interface LSNativeFunction by the two interfaces: LSIntExternalFunction and LSDoubleExternalFunction.

  • Replaced the operator NativeFunction by ExternalFunction.

  • Replaced the method LSModel.createNativeFunction() by the two following methods:

    • LSModel.createIntExternalFunction(),

    • LSModel.createDoubleExternalFunction().

  • Replaced the class LSNativeContext by LSExternalArgumentValues.

  • Added LSExpression.getExternalContext() to access the context of external functions.

  • Added the interface LSDoubleBlackBoxFunction.

  • Added the operator BlackBoxFunction.

  • Added LSModel.createDoubleBlackBoxFunction to create black-box functions.

  • Replaced the class LSBBNativeContext by LSBlackBoxArgumentValues.

  • Added LSExpression.getBlackBoxContext() to access the context of black-box functions.

  • Replaced the method LSModel.createFunction by LSModel.createLambdaFunction(). All LSFunction interfaces have also been renamed to LSLambdaFunction.

  • Added LSParam.setLogWriter() and LSParam.getLogWriter().