Generalization of the primal and dual affine scaling algorithms