optimize box layout model