zhaoruirui

导航

 
%% max z=2x1+3x2-5x3
%% s.t. x1+x2+x3=7
%%      x1+3x2+x3<=12
%%      x1,x2,x3>=0



clear all;
close all;
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=-y;

  

clc,clear
a=0;hold on
while a<0.05
    c=[-0.05,-0.27,-0.19,-0.185,-0.185];
    A=[zeros(4,1),diag([0.025,0.015,0.055,0.026])];
    b=a*ones(4,1);
    Aeq=[1,1.01,1.02,1.045,1.065];
    beq=1;LB=zeros(5,1);
    [x,Q]=linprog(c,A,b,Aeq,beq,LB);
    Q=-Q;plot(a,Q,'*k');
    a=a+0.001;
end
xlabel('a'),ylabel('Q')

  

posted on 2021-04-23 11:32  zhaoruirui  阅读(190)  评论(0)    收藏  举报