Solution of Complementarity Problems via Piecewise Linearization