This document provides instructions for solving mixed-integer linear programs using MATLAB and the optimization toolbox. It begins by explaining how to install MATLAB, YALMIP, which is a modeling environment for optimization problems, and the optimization toolbox. It then provides an example of using YALMIP to model and solve a simple mixed-integer linear program. Finally, it presents a more complex unit commitment example to illustrate modeling a real-world problem with YALMIP.
This document provides instructions for solving mixed-integer linear programs using MATLAB and the optimization toolbox. It begins by explaining how to install MATLAB, YALMIP, which is a modeling environment for optimization problems, and the optimization toolbox. It then provides an example of using YALMIP to model and solve a simple mixed-integer linear program. Finally, it presents a more complex unit commitment example to illustrate modeling a real-world problem with YALMIP.
This document provides instructions for solving mixed-integer linear programs using MATLAB and the optimization toolbox. It begins by explaining how to install MATLAB, YALMIP, which is a modeling environment for optimization problems, and the optimization toolbox. It then provides an example of using YALMIP to model and solve a simple mixed-integer linear program. Finally, it presents a more complex unit commitment example to illustrate modeling a real-world problem with YALMIP.
This document provides instructions for solving mixed-integer linear programs using MATLAB and the optimization toolbox. It begins by explaining how to install MATLAB, YALMIP, which is a modeling environment for optimization problems, and the optimization toolbox. It then provides an example of using YALMIP to model and solve a simple mixed-integer linear program. Finally, it presents a more complex unit commitment example to illustrate modeling a real-world problem with YALMIP.
Bowen Hua Department of Electrical and Computer Engineering The University of Texas at Austin November 2018 Outline • Install MATLAB and YALMIP • Example problem • Example unit commitment problem Outline • Install MATLAB and YALMIP • Example problem • Example unit commitment problem Install MATLAB and YALMIP • Cockrell School provides licenses for MATLAB. • http://www.engr.utexas.edu/itg/products/8017-matlab • Remember to install the optimization toolbox. • Download YALMIP and install it. • https://yalmip.github.io/download/ • https://yalmip.github.io/tutorial/installation/ • Unzip the downloaded file into a folder ~/YALMIP-master. • Add the folder with all its subfolders to your MATLAB path • See next slide for detailed instructions Add YALMIP to MATLAB Path • Click “Set Path” on the MATLAB toolbar
• Click “Add with Subfolders”
• Add the above-mentioned folder • Run yalmiptest in MATLAB to test the installation What is YALMIP? • YALMIP is a modeling environment for optimization problems. • It allows a user to describe an optimization problem by writing algebraic equations. • It then translate the optimization problem into a form that is recognizable by a solver. • The solver then finds the solution to the problem. Outline • Install MATLAB and YALMIP • Example problem • Example unit commitment problem Describe the problem with YALMIP • Declare variables • Define constraints • Define the objective function • Solve Example Problem
• Problem (4.45) in Section 4.8.3 on page 143 of Section 4.
• Mathematical formulation of the problem: Declare variables • Code: • binvar(1,1)defines a binary z = binvar(1,1); variable. x = sdpvar(1,1); • sdpvar(1,1)defines a continuous variable. Define constraints • Put all constraints in a list: constr = [-x == -3]; constr = [constr, 2*z <= x <= 4 * z]; • Double-sided inequality constraints are supported. Define objective function Objective = 4*z + x; Solve options = sdpsettings('verbose',1,'solver','INTLINPROG'); sol = optimize(constr,Objective,options); • We use the built-in mixed-integer linear program solve of MATLAB, intlinprog. • To see the optimal objective function value, we can use: • value(Objective) • To see the optimal value of the decision variables, we can use: • value(x) • value(z) Outline • Install MATLAB and YALMIP • Example problem • Example unit commitment problem Example unit commitment problem • Unit Commitment Example in Section 10.8.1 on page 126 of Section 10. • Mathematical formulation of the problem: Declare variables • Code: • binvar(2,1)defines a 2- z1 = binvar(2,1); column-vector of binary z2 = binvar(2,1); variables. u1 = binvar(2,1); • sdpvar(2,1)defines a 2- u2 = binvar(2,1); column-vector of continuous P1 = sdpvar(2,1); variables. P2 = sdpvar(2,1); • z1, u1, P1 are variables for generator 1. Define constraints • Bounds for power outputs. These constraints are defined in vector form: private_constr = [0 <= P1 <= 100 * z1]; private_constr = [private_constr, 0 <= P2 <= 50 * z1]; • Logical constraints between startup and on/off variables: private_constr = [private_constr, u1(1) == z1(1) - 1]; private_constr = [private_constr, u1(2) == z1(2) - z1(1)]; private_constr = [private_constr, u2(1) == z2(1)]; private_constr = [private_constr, u2(2) == z2(2) - z2(1)]; • Power balance constraints: power_balance = [P1(1) + P2(1) == 110]; power_balance = [power_balance, P1(2) + P2(2) == 125]; Define objective function Objective = 1000 * (sum(u1) + sum(u2)) + 25 * sum(P1) + 35 * sum(P2); Solve options = sdpsettings('verbose',1,'solver','INTLINPROG'); sol = optimize([private_constr, power_balance],Objective,options); • To see the optimal objective function value, we can use: • value(Objective) • To see the optimal value of the decision variables, we can use: • value(P1)