matlab学习——01线性规划

01线性规划

format compact;
% min fx
% Ax<=b
% Aeq*x=beq
% lb<=x<=ub
%
% max z=2x1+3x2-5x3
% x1+x2+x3=7
% 2x1-5x2+x3>=10
% x1+3x2+x3<=12
% x1,x2,x3>=0

f=[-2;3;5];
a=[-2,5,1;1,3,1];
b=[-10;12];
aeq=[1,1,1];
beq=7;
[x,y]=linprog(f,a,b,aeq,beq,zeros(3,1));
x
y

 

原文地址:https://www.cnblogs.com/caiyishuai/p/11394603.html