The Solver Platform SDK can be used in MATLAB via three different APIs:
- MATLAB Optimization Toolbox API -- For users with existing MATLAB code written for the Optimization Toolbox, the SDK offers a compatible API with functions such as linprog, quadprog, fmincon and others. Each of these functions solves a specific type of optimization problem, and takes a list of vector, matrix, and function address arguments. You must know how to formulate your problem, select the appropriate function call, construct a set of "matching" vector and matrix arguments, and callable functions in the case of nonlinear problems.
- MATLAB Object-Oriented API -- For users who are implementing new, larger or more complex problems, or who are using the SDK with both MATLAB and a programming language such as C++, C# or Java, this API offers a higher-level way to describe an optimization problem using objects (such as a Problem, Variable and Function) with properties and methods. A single method Optimize is used to solve all types of optimization problems -- including types such as mixed-integer programming and conic optimization that are not supported by the Optimization Toolbox API.
- MATLAB Procedural API -- For users more accustomed to procedural programming, the SDK offers a complete Procedural API, with access to all the power of the Object-Oriented API. Function calls in this API correspond nearly one-to-one with object creation, property assignments, and method calls used in the Object-Oriented API. Code for the Object-Oriented API and the Procedural API tends to be more verbose than code for the Optimization Toolbox API, but is highly readable and makes clear the role of each vector, matrix and function argument.
We'll illustrate the three APIs with a simple example of a constrained nonlinear optimization problem. This is Example 4 in the extensive set of MATLAB Examples supplied with the Solver Platform SDK.
x1*x1 + x2*x2
x1 + x2 = 1
x1 * x2 >= 0
0 <= x1, x2 <= 1
Please click the links below to see MATLAB code for this problem, written using the three APIs: