Idempotency: A general linear max-plus solution technique