Train problem

Hello fellow programmers. How would you solve a problem where you have a train kompozition with wagons and cargo in them. Wagons can be two types. If type A you can hold multi different cargo in them but if it's type B then you can only hold one type of cargo in them. Also every wagon has weight limit so you can't just put all the cargo in the same wagon. Now for the good part. How would you switch the cargo between wagons so you use minimum amount of wagons to hold the cargo. You can only move cargo to the previous and next wagon at a time. Also you cant move cargo from wagon type A to wagon type B. Any ideas?
bump
Topic archived. No new replies allowed.