Efficient algorithms for calculating optimal designs in pharmacokinetics and dose finding studies