  This paper studies an open question in the warehouse problem where a merchant
trading a commodity tries to find an optimal inventory-trading policy to decide
on purchase and sale quantities during a fixed time horizon in order to
maximize their total pay-off, making use of fluctuations in sale and cost
prices. We provide the first known polynomial-time algorithms for the case when
there are fixed costs for purchases and sales, optional complementarity
constraints that prohibit purchasing and selling during the same time period,
and bounds on purchase and sales quantities. We do so by providing an exact
characterization of the extreme points of the feasible region and using this to
construct a suitable network where a min-cost flow computation provides an
optimal solution. We are also able to provide polynomial extended linear
formulations for the original feasible regions. Our methods build on the work
by Wolsey and Yaman (Discrete Optimization 2018). We also consider the problem
without fixed costs and provide a fully polynomial time approximation scheme in
a setting with time-dependent bounds.
