  We introduce and study a general version of the fractional online knapsack
problem with multiple knapsacks, heterogeneous constraints on which items can
be assigned to which knapsack, and rate-limiting constraints on the assignment
of items to knapsacks. This problem generalizes variations of the knapsack
problem and of the one-way trading problem that have previously been treated
separately, and additionally finds application to the real-time control of
electric vehicle (EV) charging. We introduce a new algorithm that achieves a
competitive ratio within an additive factor of one of the best achievable
competitive ratios for the general problem and matches or improves upon the
best-known competitive ratio for special cases in the knapsack and one-way
trading literatures. Moreover, our analysis provides a novel approach to online
algorithm design based on an instance-dependent primal-dual analysis that
connects the identification of worst-case instances to the design of
algorithms. Finally, we illustrate the proposed algorithm via trace-based
experiments of EV charging.
