Algorithm for implementing parking space reservation for generic parking lots
Hey I'm trying to implement reservation system for parking lots registered at my website. I have a hardware that detects the presence and absence of car at a parking space. So assume I have this hardware set up for all the parking spaces in all the parking lots signed up at my website and therefore I have the information of which parking space is vacant and which is occupied. My website provides an interface to allow users to reserve a parking space at a parking lot. My website also gives privileges to parking lot owners allowing them to edit certain data with respect to their parking lot.
Assume a parking lot P has 10 parking spaces namely P1, P2.. P10. Apart from reserving a parking space through my website, users can directly go to parking lot P and occupy a vacant parking space. Either ways the sensors pick up the information about a parking space and thus assume my database containing information about P is continuously updated. Okay having said that I need your opinion/help on the following:
I'm thinking about allowing a user to reserve a space only if it is vacant at the time he accesses my website. Is this the best idea? It's not, if I consider this scenario: Assume user1 directly goes to P and occupie开发者_如何转开发s P1 at 10 am. At 11 am, user2 accesses my website to reserve a space at P say P1 from 5 pm to 6 pm. Since at 11 am, user1 is still occupying P1, I won't allow user2 to reserve the space. The trade-off here would be that in most cases user1 is going to vacate that space before 5 pm. So may be not allowing user2 to reserve was a bad idea. On the other hand, if I allow user2 to reserve P1 and suppose user1 doesn't vacate P1 before 5pm then user2 will be stranded.
Say P1 is reserved from 5pm to 6pm by user1. If user2 directly goes to P and tries to occupy P1 at 3pm, then should I allow it? If I allow it, I don't know if user2 would vacate the space before 5pm. If I don't allow user2 to occupy P1 at 3pm, then it is like losing two hours of income for parking lot owners.
In order to handle the above two scenarios I should allow some flexible options for the parking lot owners registered with my website. What do you think are the optimal options I could offer for the parking lot owners in my website?
Any help is greatly appreciated. Thanks in advance. SerotoninChase.
A reservation system, if it is going to have any meaning, will restrict the availability of spaces to drive-in customers. Most systems (restaurants, hotels, car rentals, etc.) have a reasonable way of estimating (or enforcing) the duration of a resource allocation. In cases where there is uncertainty, then you need to balance the various risks. How do you balance? First, you need to estimate the probability of each kind of failure (having empty spaces that could have been rented; lacking a space for a customer with a reservation). Then you need to estimate the cost of each kind of failure. Only then do you have a model by which you can evaluate various strategies.
You should probably be thinking about an adaptive strategy—one that not only adapts to sensor data but also adjusts the algorithm parameters based on observed failures of the prediction process. (In other words, one that learns the probabilities as it goes.) I expect that the parameters also need to vary with time (e.g., drivers behave differently on the weekend than during a work day). Of course, working with the business owners to reduce the uncertainties will help as well.
The best advice, I think, is to talk to your potential customers (the parking lot owners) about these issues. They will have a much better understanding of what would work and how much they are willing to change their business rules for the sake of offering a higher-value product.
I think most of your problems will be solved if you had a metering system where you allocate the parking lot for a number of hours. This will allow for you to plan and optimize your allocations, but has the down side of policing the parking lots for violations. It would be a good idea to have some vacant slots for any hiccups caused by the violations.
Why don't you just allow user to enter any free parking space available i.e. don't tie reservation to a specific parking spot. It's OK if he knows that he'll have one spot free at the time he needs it, right? This simplifies algorithm in means of having to track only overall number of free parking spots.
or you can simply send a message to parking service to remove that car when another reservation is made for that place :)
精彩评论