I have a set of boxes as those pictured below. I can only remove boxes that dosen't have any boxes on top of it. In every "move" I can move any box that is currently available, but I have limitations on how much the boxes can weigh in a single move. The numbers are the boxes weight.

So for example, if my capacity was 4 in the example above, I could have moved both A and E in a single sweep, but if it were 3, I would have had to choose between moving A or E.
I am unsure of how to think about this problem. I was thinking about formulating it as a graph with costs between the nodes corresponding to the weight, and then having a max flow limit. But it would be problematic since if, for example, I do the moves (A),(BE) (having 3 as max capacity), the cost between C and D would be 0. But if I would do (A),D, it would not be zero.
Any suggestion and pointers?