One, linear programming problems
Both the known objective function and the constraint condition are linear functions, and the minimum value (optimal value) problem of the objective function is obtained.
1. Solution method: Solve with Linprog function
2.linprog function Use form:
X=linprog (F,A,B)
X=linprog (F,A,B,AEQ,BEQ)
X=linprog (F,a,b,aeq,beq,lb,ub)
X=linprog (f,a,b,aeq,beq,lb,ub,x0)
X=linprog (f,a,b,aeq,beq,lb,ub,x0,options)
[X,fval]=linprog (...)
[X, FVal, Exitflag]=linprog (...)
[X, FVal, exitflag, Output]=linprog (...)
[X, FVal, exitflag, Output, Lambda]=linprog (...)
3. Introduce one of the most commonly used:
[X,fval,exitflag,output,lambda] = Linprog (F,a,b,aep,beq,lb,ub);
where f is the coefficient matrix of the objective function, and A and B are the parameters of the inequality constraint, Aeq and beq are the parameters of the equality constraint, and the value range of lb and UB for X.
lambda.ineqlin-inequality constraints A, B
lambda.eqlin-Equality Constraint AEP,BEP
lambda.upper-Upper bound Condition UB
lambda.lower-Nether Condition LB
4. Example:
Objective function: F (x) =–5x1–4x2–6x3,
Constraint conditions:
X1–X2 + x3≤20
3x1 + 2x2 + 4x3≤42
3x1 + 2x2≤30
0≤x1, 0≤X2, 0≤x3
MATLAB Program:
>> f = [-5; -4; -6]; A = [1-1 1;3 2 4;3 2 0]; b = [ -; the; -]; LB = Zeros (3,1);>> [X,fval,exitflag,output,lambda] = Linprog (f,a,b,[],[],lb);>>xx=0.0000 15.0000 3.0000>>Fvalfval= -78.0000
二、二次-Type planning problems
It is much simpler to understand the problem of linear programming and then to learn two-time programming problems, which can be analogous.
1. Solution method: Solve by using Quadprog function
2.quadprog function Use form:
x = Quadprog (h,f)
x = Quadprog (h,f,a,b)
x = Quadprog (H,F,A,B,AEQ,BEQ)
x = Quadprog (H,f,a,b,aeq,beq,lb,ub)
x = Quadprog (h,f,a,b,aeq,beq,lb,ub,x0)
x = Quadprog (h,f,a,b,aeq,beq,lb,ub,x0,options)
x = Quadprog (problem)
[X,fval] = Quadprog (h,f,...)
[X,fval,exitflag] = Quadprog (h,f,...)
[X,fval,exitflag,output] = Quadprog (h,f,...)
[X,fval,exitflag,output,lambda] = Quadprog (h,f,...)
3. Example:
MATLAB Program:
>> H = [4 -4 ;-4 8 ];f = [-6 ;-3 ]; A = [1 1 ];b = [3 ; 9 ];lb = ones (2 , 1 ); >> [X,fval,exitflag,output,lambda] = Quadprog (H,f,a,b,[],[],lb); >> xx = 1.0500 >> Fvalfval =-11.0250
Note: If the solution is the maximum value problem can also be converted to the optimization problem.
Solving linear programming problems and two-type problems with MATLAB learning notes