In-line and off-line optimization of freeze-drying cycles for pharmaceutical products