The basic content of linear programming problem
Linear programming to solve is the independent variable linear constraints under certain conditions, such that the linear objective function determined maximum or minimum of the problem.
In its basic form can be summarized as:
\ [\ _ min {X} ^ {T} F X \]
\[ \text { s.t. }\left\{\begin{array}{l}{A x \leq b} \\ {\text {Aeq} \cdot x=b e q} \\ {l b \leq x \leq u b}\end{array}\right. \]
among them:
\ (F \) is the coefficient matrix of the objective function, \ (X \) as the independent variable.
\ (A \) is the coefficient matrix of inequality constraints, \ (B \) to the right end of the coefficient matrix inequality constraints.
\ (Aeq \) is the coefficient matrix of the constraint equation, \ (BEQ \) is the coefficient matrix of the right equality constraints.
\ (LB \) the lower limit of the range of the matrix argument, \ (UB \) as the independent variable in the range of the upper limit of the matrix.
Matlab model code
Call form
[x,fval] = linprog(f,A,b) [x,fval] = linprog(f,A,b,Aeq,beq) [x,fval] = linprog(f,A,b,Aeq,beq,lb,ub)
Input variables
f is the coefficient matrix of the objective function
A is a coefficient matrix inequality constraints (Note that the default direction is less inequality, if not less than, inverse number needs to be taken)
b is the coefficient matrix of inequality constraints right (note that the default direction is less inequality, if not less than, inverse number needs to be taken)
Aeq equality constraints coefficient matrix
beq equality constraints right coefficient matrix
The lower limit of the range for matrix lb argument
ub ranges from the upper limit of the argument matrix
In the call, if there equality or inequality constraints, which may be input by []
an empty matrix representation.
Output variables
- x independent variable value matrix
- fval objective function value
Case presentation
The objective function and constraints
\ [\ Z = 2 min x_ {1} {+3 x_ x_ + 2} {3} \]
\[ \left\{\begin{array}{l}{x_{1}+4 x_{2}+2 x_{3} \geq 8} \\ {3 x_{1}+2 x_{2} \geq 6} \\ {x_{1}, x_{2}, x_{3} \geq 0}\end{array}\right. \]
Matlab program
f = [2;3;1]; A = [1,4,2;3,2,0]; b = [8;6]; lb = zeros(3,1); [x,fval] = linprog(f,-A,-b,[],[],lb,[])
operation result
Optimization terminated. x = 0.8066 1.7900 0.0166 fval = 7.0000