LocalSolver 10.0¶
Modeler API¶
The modeler API contains classes for interacting with the LSP virtual machine from your favorite language. This new API allows you to:
Load modules from existing LSP files, or create new ones, and execute them.
Interact with the variables of your LSP program. You can retrieve, set or create new variables from your favorite language that will be exposed to your LSP code. Numbers and strings are converted to their LSP equivalent, and array-like structures are converted to LSP maps.
Expose methods developped in your favorite language as LSP functions.
For more details about the modeler API, please check out the API reference in Python, C++, C# or Java.
JSON Module¶
The LSP language has now a JSON module. It allows you to read JSON content from a file or a string, and to convert JSON numbers, strings, arrays and objects into their LSP equivalent. It is also possible to write LSP values in a JSON file or a string.
For more details about the JSON module, please check out the documentation on JSON module in the standard library.
Black-box optimization¶
Black-box models can now be constrained with analytical constraints. It means that all LocalSolver operators can be used in a black-box model as in a classical one, except the operators refering to collection variables. Note that the constraints must not involve the black-box call.
Evaluation points can be added to a black-box model via the black-box context. An evaluation point is a point for which you know the coordinates and the return value of the black-box function. They can be used to warm-start the solver, when the function is particularly expensive to evaluate or if you already have a good estimate of the optimal point.
The return type of the black-box function can now be integer or double, instead of only double.
For more details about how to create a black-box model, please check out the black-box examples on the example tour page.
API Changes¶
LSP¶
Added the JSON module.
Python¶
Added the
modeler
package.Added
LSModel.create_int_blackbox_function()
andLSModel.int_blackbox_function()
to create integer black-box functions.Added the
LSBlackBoxEvaluationPoint
class.Added the following methods to create and manipulate evaluation points associated to a black-box function:
LSBlackBoxContext.create_evaluation_point()
LSBlackBoxContext.get_nb_evaluation_points()
LSBlackBoxContext.get_evaluation_point()
Changed the default return value of
LSParam.get_log_writer()
fromNone
(which meant standard output) tosys.stdout
.Changed the behavior of
LSParam.set_log_writer(None)
: it now disables logging whereas before it restored the standard output.
C++¶
Added the
modeler
package.Added the
LSBlackBoxEvaluationPoint
class.Added the following methods to create and manipulate evaluation points associated to a black-box function:
LSBlackBoxContext::createEvaluationPoint()
LSBlackBoxContext::getNbEvaluationPoints()
LSBlackBoxContext::getEvaluationPoint()
C#¶
Added the
modeler
package.Added the delegate
LSIntBlackBoxFunction
.Added
LSModel.CreateIntBlackBoxFunction()
andLSModel.IntBlackBoxFunction()
to create integer black-box functions.Added the
LSBlackBoxEvaluationPoint
class.Added the following methods to create and manipulate evaluation points associated to a black-box function:
LSBlackBoxContext.CreateEvaluationPoint()
LSBlackBoxContext.GetNbEvaluationPoints()
LSBlackBoxContext.GetEvaluationPoint()
Changed the default return value of
LSParam.GetLogWriter()
fromnull
(wich meant standard output) toConsole.Out
.Changed the behavior of
LSParam.SetLogWriter(null)
: it now disables logging whereas before it restored the standard output.Added the following methods to copy all values of the concerned element to an array:
LSBlackBoxArgumentValues.CopyTo()
If you need to access all the values of the element, these methods are recommended because they are more performant than a for-loop getting the values one by one.
Java¶
Added the
modeler
package.Added the interface
LSIntBlackBoxFunction
.Added
LSModel.createIntBlackBoxFunction()
andLSModel.intBlackBoxFunction()
to create integer black-box functions.Added the
LSBlackBoxEvaluationPoint
class.Added the following methods to create and manipulate evaluation points associated to a black-box function:
LSBlackBoxContext.createEvaluationPoint()
LSBlackBoxContext.getNbEvaluationPoints()
LSBlackBoxContext.getEvaluationPoint()
Changed the default return value of
LSParam.getLogWriter()
fromnull
(wich meant standard output) toSystem.out
.Changed the behavior of
LSParam.setLogWriter(null)
: it now disables logging whereas before it restored the standard output.Added the following methods to copy all values of the concerned element to an array:
LSArray.copyTo()
LSCollection.copyTo()
LSBlackBoxArgumentValues.copyTo()
LSExternalArgumentValues.copyTo()
If you need to access all the values of the element, these methods are recommended because they are more performant than a for-loop getting the values one by one.