Object-oriented APIs are provided for C#/.NET allowing a full integration of LocalSolverBlackBox in your C#/.NET business applications. LocalSolverBlackBox’s APIs are lightweight, with only a few classes to manipulate. Remind that LocalSolverBlackBox is a model & run math programming solver: having instantiated the model, no additional code has to be written in order to run the solver.

Build your model

First, you have to create a LocalSolverBlackBox environment. It is the main class of the LocalSolverBlackBox library. Then, use the methods of the class LSBBModel to build your model with expressions. Expressions are a particularly important concept in LocalSolverBlackBox. In fact, every aspect of a model is an expression: variables and objective are LSBBExpression. You can use the available shortcut methods like LSBBModel.Bool, LSBBModel.Call, LSBBModel.CreateNativeFunction to create LSBBExpressions. A LocalSolverBlackBox model is composed of a Call expression. The first argument of this expression is an expression of type NativeFunction and other arguments are decisions variables that will be passed as arguments to the native function.

Solve your model

Once you have created your model, you have to close it with LSBBModel.Close() and call LocalSolverBlackBox.Solve() to launch the resolution. By default, the search will continue until an optimal solution is found. To set a time limit or an evaluation limit gets an instance of LSBBParam with LocalSolverBlackBox.GetParam() then set the according attributes.

Retrieve the solution

You can retrieve the solution with the method LocalSolverBlackBox.GetSolution(). The object it returns carries the values of all expressions in the model.