coded basic algorithm to get a minimal number of needed locations
first merge with jakub
added location bound computation
merge with jakub