Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimizing a Parking Lot Problem. What algorithms should I use to fit the most amount of cars in the lot?

What algorithms (brute force or not) would I use to put in as many cars (assume all cars are the same size) in a parking lot so that there is at least one exit (from the container) and a car cannot be blocked. Or can someone show me an example of this problem solved programmatically.

The parking lot varies in shape would be nice but if you want to assume it's some invariant shape that is fine.

Another Edit: Assume that driving distance in the parking lot is not a factor (although it would be totally awesome if it was weighted factor to number of cars in lot).

Another Edit: Assume 2 Dimensional (no cranes or driving over cars).

Another Edit: You cannot move cars around once they are parked (it's not a valet parking lot).

like image 821
Adam Gent Avatar asked May 13 '10 17:05

Adam Gent


People also ask

How do you optimize a parking space?

To further optimize space in the parking areas, consider creating a lot that is rectangular rather than an irregular shape. Another standard recommendation is to make the long sides of the parking lot parallel to each other, with parking spaces located along the perimeter of the lot.

What is the most efficient parking setup when you have two direction access?

Ideally, parking lots should be rectangular with parking on both sides of access aisles. For two-way traffic flow, parking spaces perpendicular (90 degrees) to the aisles provide the most efficient design.

What is the most common form of parking that is also the most difficult to learn?

Parallel parking is most common on streets and roads, because perpendicular or angled parking may take up too much driving space. It is one of the hardest skills for a driver to learn because it involves maneuvering your car to fit perfectly between two already parked vehicles.


1 Answers

Well, let's simplify/concreteify a bit. Assume that our cars are unit squares, the parking lot is N x N, and we need to enter/exit from the lower left corner. A simple pattern gets the lot almost 2/3 full with cars (shown for N=12):

+------------+
|C CC CC CC C|
|C CC CC CC C|
|C CC CC CC C|
|C CC CC CC C|
|C CC CC CC C|
|C CC CC CC C|
|C CC CC CC C|
|C CC CC CC C|
|C CC CC CC C|
|C CC CC CC C|
|C CC CC CC C|
             |
  -----------+

I can prove that the best you can possibly do is to get the lot 2/3 full. Imagine that you build up the empty spaces by starting with a completely full garage and driving out a (currently reachable) car one at a time. Each time you remove a car, you produce up to 3 newly reachable cars, and remove one once-reachable car (now an empty space). So for every space you make, you create at most 2 more reachable cars. To make 2/3 N^2 reachable cars, you need to make at least 1/3 N^2 spaces, and that's all the squares you have. So you can fill the garage at most 2/3 full.

The simple pattern above is asymptotically optimal, as its density approaches 2/3 as N -> infinity. (Kinda boring, I was hoping some tree-looking pattern would do better.)

like image 57
Keith Randall Avatar answered Sep 22 '22 12:09

Keith Randall