clear;
clc;
format short;
C=[500; 250; 950; 1250; 250; -100; 750];
f=C';
A=[1 1 1 0 0 0 0;
   0 0 0 1 1 0 0;
   0 0 0 0 0 1 1;
   -1 -1 -1 -1 -1 -1 -1
   -1 0 0 0 0 -1 0;
   0 0 0 0 0 0 1];
B=[150 250 200 -500 -100 50];
b=B';
Aeq=zeros(1,7);
beq=0;
LB=zeros(7,1);
UB=[150; 150; 150; 250; 250; 200; 200];
[X,J]=linprog(f,A,b,Aeq,beq,LB,UB)
M =[X(1) X(2) X(3)  0;
   0   X(4)  0   X(5);
  X(6)  0    0   X(7);
  300-X(1)-X(6) 200-X(2)-X(4) 250-X(3) 250-X(5)-X(7)]
Total_biaya=1000*M(1,1)+500*M(1,2)+1200*M(1,3)+1500*M(2,2)+500*M(2,4)+400*M(3,1)+1000*M(3,4)+ 500*M(4,1)+250*M(4,2)+250*M(4,3)+250*M(4,4)
harus_sama_dengan_J=J+325000
OK='OK'

