Efficient solution of piecewise-linear structures