first, we need to download Cplex's installation package on IBM's official website .
Download Address: http://www-01.ibm.com/software/websphere/products/optimization/cplex-studio-community-edition/.
Community-edition can be used for free, but only up to 1000 variables or 1000 constraints are optimized. The extended version requires
To buy, the price is particularly expensive, seemingly tax-free and nearly 10,000 dollars a year, the individual can not afford.
second, in the Matlab menu bar to find the option to set the path (set path), select "Add and Include subfolders" To add the Cplex installation path Cplex\matlab This folder, as shown in the figure:
Verify success, Command Window input: Doc Cplex, if the Help document appears, the path is added successfully.
Third, find the Cplex installation path in the Cplex\examles\src folder inside the MATLAB example
Four, in the example on the basis of changes to their own problems, can be run.
Yalimp
In MATLAB to edit the CPLEX document, you must use the syntax of MATLAB, the model of the coefficient matrix with A, B, F is expressed. But sometimes it's cumbersome and time-consuming, and you can use a YALMIP toolbox developed by a cow to make it easy to enter as a mathematical model.
First, download the YALMIP Toolbox.
Website: https://yalmip.github.io/,download.
unzip the files and put them into the Toolbox folder in the installation path of MATLAB program.
third, set the path. Select "Add and Include subfolders" To add the path to the YALMIP, as shown in the figure:
Iv. Test success: Doc YALMIP
Five, then can be compiled with YALMIP syntax.
Tutorials on the YALMIP official website are: https://yalmip.github.io/tutorials/
A better command:
Sdpvar: Real variables, Intvar: integer variables, binvar:0-1 variables
Check: Checks to see if the constraint is met (check the remainder of the constraint condition)
Value: You can view the values of a variable or an expression
Assign: You can assign a value to a variable, which is important when debugging a command
Options=sdpsettings (' Solver ', ' Cplex '); Set the solve method to call CPLEX
Optimize (constraints,f,options); YALMIP the command to solve.