Partially-Ordered Knapsack and Applications to Scheduling