Near-optimal control with adaptive receding horizon for discrete-time piecewise affine systems