Optimize fitting a piece within a location