How to input sets as features
In ML you really need good examples and then things for which you don't know the outcome. You learn from the good examples and then apply this &quot;knowledge&quot; to the examples for which you wish to know the outcome.
I agree that Mathematical Optimisation would probably be a better route to take in a problem such as this.
Alternatively, if you want to imply some kind of connection between sets, you could create a categorical (dummy) variable that designates such. If I understand you correctly here is an example
         item1    item2   basket1  basket2  basket3  GroundTruth (target)
order 1  Banana   Apple   True     False    False    warehouse1
order 2  Toy      Carrot  False    True     False    warehouse2
order 3  Picture  Shoe    False    False    True     warehouse3

You could also include the items in the warehouses in a similar way though if you have lots of different items, lots of warehouses, lots of baskets and not relatively enough training example this is going to get pretty sparse pretty quickly.