  Online knapsack problem is considered, where items arrive in a sequential
fashion that have two attributes; value and weight. Each arriving item has to
be accepted or rejected on its arrival irrevocably. The objective is to
maximize the sum of the value of the accepted items such that the sum of their
weights is below a budget/capacity. Conventionally a hard budget/capacity
constraint is considered, for which variety of results are available. In modern
applications, e.g., in wireless networks, data centres, cloud computing, etc.,
enforcing the capacity constraint in expectation is sufficient. With this
motivation, we consider the knapsack problem with an expected capacity
constraint. For the special case of knapsack problem, called the secretary
problem, where the weight of each item is unity, we propose an algorithm whose
probability of selecting any one of the optimal items is equal to $1-1/e$ and
provide a matching lower bound. For the general knapsack problem, we propose an
algorithm whose competitive ratio is shown to be $1/4e$ that is significantly
better than the best known competitive ratio of $1/10e$ for the knapsack
problem with the hard capacity constraint.
