  Many important invariants for matroids and polymatroids, such as the Tutte
polynomial, the Billera-Jia-Reiner quasi-symmetric function, and the invariant
$\mathcal G$ introduced by the first author, are valuative. In this paper we
construct the $\Z$-modules of all $\Z$-valued valuative functions for labeled
matroids and polymatroids on a fixed ground set, and their unlabeled
counterparts, the $\Z$-modules of valuative invariants. We give explicit bases
for these modules and for their dual modules generated by indicator functions
of polytopes, and explicit formulas for their ranks. Our results confirm a
conjecture of the first author that $\mathcal G$ is universal for valuative
invariants.
