Efficient profile aggregation and policy evaluation in a middleware for adaptive mobile applications