I need to formalize two query descriptions into mathematical notation. The source of this description, if anyone is interested in broader context.
Query 1: Frequent routes
The goal of the query is to find the top 10 most frequent routes during the last 30 minutes. A route is represented by a starting grid cell and an ending grid cell. All routes completed within the last 30 minutes are considered for the query. The output query results must be updated whenever any of the 10 most frequent routes changes.
I have managed to come up with this formal description:
$$\max\nolimits_{R_i \in R}$$
Where the following applies:
$R$ = frequency of all routes, $R_i$ = frequency of i-th route
But how would I specify top 10, not only the maximum?
Query 2: Profitable areas
The goal of this query is to identify areas that are currently most profitable for taxi drivers. The profitability of an area is determined by dividing the area profit by the number of empty taxis in that area within the last 15 minutes. The profit that originates from an area is computed by calculating the median fare + tip for trips that started in the area and ended within the last 15 minutes. The number of empty taxis in an area is the sum of taxis that had a drop-off location in that area less than 30 minutes ago and had no following pickup yet.
I have managed to come up with this formal description:
$$profitability\_of\_cell_X = \frac{median\_profit\_in\_cell\_id_X}{empty\_taxies\_in\_cell\_id_X} = \frac{\mu_{T_i \in Trip(X)} (T_{i,fare} + T_{i,mta})}{\sum\nolimits_{Ta \in X} 1}$$
Where the following applies:
$X$ = Cell X = Area X, $\mu$ = median value
Again I would need to specify that we are interested in top 10 most profitable areas?
Time constraints
I do not know how to add time constraints into formal mathematical notation. Is this even possible?