当前位置:网站首页>Matlab linear programming model learning notes

Matlab linear programming model learning notes

2022-06-26 06:53:00 Yunxi my goddess

1、MATLAB Standard form of linear programming

 Insert picture description here

2、 Example

(1)

 Insert picture description here
The greater than sign should be converted to the less than sign , That is, both sides become opposite numbers ; The standard type is min, If max, Need to put c Take the negative

c=[2;3;-5];% The coefficients of the objective function , Semicolons separate 
a=[-2,5,-1;1,3,1];% The coefficient of inequality , Pay attention to the symbols 
b=[-10;12];% The value to the right of the inequality 
aeq=[1,1,1];% Equational Aeq
beq=7;% Equational Beq
x=linprog(-c,a,b,aeq,beq,zeros(3,1));% Be careful c Take the negative ,x obtain 3 That's ok 1 Columns of the matrix , namely x1,x2,x3 The value of 
value=c'*x;%z=value= coefficient matrix *x Value matrix , So first transpose 

(2)

 Insert picture description here

c=[2;3;1];
a=[-1,-4,-2;-3,-2,0];
b=[-8;-6];
[x,y]=linprog(c,a,b,[],[],zeros(3,1));
% here y Is the final result z
原网站

版权声明
本文为[Yunxi my goddess]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260643411598.html