Theoretical and Practical Aspects of Outpatient Clinic Optimization