clear all
nMax=50;
nMin=1;
Nrep=3;
iterations=zeros(nMax,1);
for n=nMin:nMax
    n
    repetition=1;
    while repetition <= Nrep
        A=randi(1000,n,n)-500;
        b=randi(1000,n,1)-500;
        c=randi(1000,n,1)-500;
        [description,~,~,it,~,~]=simplex(A,b,c);
        if (strcmp(description,'feasible and bounded'))
            iterations(n)=iterations(n)+it;
            repetition=repetition+1;
        end
    end
end

iterations=iterations/Nrep;
loglog(iterations);
xlabel('n');
ylabel('number of pivots');