  This paper contributes to the study of rank-metric codes from an algebraic
and combinatorial point of view. We introduce $q$-polymatroids, the
$q$-analogue of polymatroids, and develop their basic properties. We associate
a pair of q-polymatroids to a rank-metric codes and show that several
invariants and structural properties of the code, such as generalized weights,
the property of being MRD or an optimal anticode, and duality, are captured by
the associated combinatorial object.
