Piecewise-linear controller synthesis with applications to inventory control of switched production systems