function maxval=simplex0(dict)
    [val,s] = max(dict(1,2:end));
    s = s(1); % s is entering variable
    while val>0 
        [val, r] = max( dict(2:end,s+1)./dict(2:end,1) ); 
        r = r(1); % r is leaving variable
        s
        r
        dict = pivot(dict,s,r)
    
        [val,s] = max(dict(1,2:end));
        s = s(1); % s is entering variable
    end
    maxval = -dict(1,1);
end