City bicycle rental scheme
A large-scale bicycle rental scheme that has around 18,000 bicycles and 1,200 bicycle stations can be used to demonstrate the use case of Decision Server Insights, and in particular aggregation.
A city bicycle rental scheme with an estimated average daily usage of 110,000 provides a good use case for Decision Server Insights. Each station is equipped with an automatic rental terminal, a map of other nearby stations and stands for dozens of bicycles. The rental terminals also give information about neighboring stations, including location, number of available bicycles, and open stands. If a user arrives with a rented bicycle at a station without open spots, the terminal grants another 15 minutes of free rental time. A fleet of 23 bicycle-transporting vehicles is used daily to redistribute bicycles between empty and full stations.
There is a certain amount of logic the application must process. The premise of the scheme is that customers pick up an available bike from a bike station, and drop it off at some other bike station. The customers are charged according to certain pricing rules.
To use the system, customers must take out a subscription, which allows the subscriber an unlimited number of rentals. Subscriptions can be purchased per day, per week, per month, or per year. With a subscription, bike rental is free for the first half hour of every individual trip; an unlimited number of such free trips can be made per day.
The business logic of the application is summarized by the following rules:
- If a customer arrives with a rented bicycle at a station without an open spot, the terminal grants another 15 minutes of free rental time.
- A trip that lasts longer than 30 minutes incurs a charge for each subsequent 30-minute period. The increasing price scale is intended to keep the bikes in circulation.
- A year subscription allows the customer to have the first 45 minutes free on each trip, its price is reduced for customers that are aged under 27, and for students.
- Some stations that are located above an altitude of 60 meters
are called V+. They give any customer who returns a bicycle from a
non-V+ station 15 free minutes of rental: if a rental lasts more than
30 minutes, 15 minutes are deducted to calculate the amount that the
customer must pay.
For example, a 45-minute trip to a V+ station is free. If the rental lasts 30 minutes or less, the 15 minutes are added to a bonus V+ account, and can be used for future rentals that exceed 30 minutes.
The solution has a number of agents and aggregations to process the arrival of events:
- Bike Station Rule Agent
- An agent that is bound to the Bike Station entity receives Bike Station Utilization Update events. The entity stores the chronology. The chronology is updated as a result of the rules that are fired on arrival of the various events. Rules emit a Bike Rented events when they detect a bike at a station is removed from a slot, and a Bike Returned event when a bike is added. Data such as how long has the number of filled slots been over 90% is also stored, but is periodically reset at midnight.
- Aggregate of Bikes Returned and Bikes Rented events
- Calculates the total number of bikes rented (returned) so far today, across all bike stations.
- Aggregate of Landmark entities
- Calculates the total number of bikes available "near" each landmark at the current time. It takes advantage of static association of landmark with nearby bike stations, and uses the chronology in each bike station.
- Landmark Rule Agent
- Generates Near Landmark Update events when a rule receives a Bike Station Utilization Update Event. It determines whether the station is within the neighborhood of a certain landmark and emits a Near Landmark Update event, which includes data from the input event and also information about the landmark.
- Aggregate of Near Landmark Update events
- Calculates the percentage of time over the last N hours which bike stations near a landmark exceed 90% capacity.
- Aggregate of Bike Station entities
- Triggered every 3 minutes to determine which stands within 5 minutes walking distance of a landmark are full for at least the last 15 minutes.
- Full Bike Station Rule Agent
- Reads the result of the Bike Station aggregate and triggers an
alert if there are full or empty stands.
- When the capacity of a station > N during the last 20 minutes emit a station too full warning.
- When the capacity of a station < N during the last 20 minutes emit a station too empty warning.
- Predictive Scoring Agent
- Calls an SPSS® predictive model to determine the closest station with the highest probability of having bikes available to rent. The model takes a list of stations, a day of the week and a time of day. It predicts the number of bikes available at each of the stations.