factory optimization