  We present an optimization procedure for generic polygonal or polyhedral
meshes, tailored for the Virtual Element Method (VEM).
  Once the local quality of the mesh elements is analyzed through a quality
indicator specific to the VEM, groups of elements are agglomerated to optimize
the global mesh quality.
  The resulting discretization is significantly lighter: we can remove up to
80$\%$ of the mesh elements, based on a user-set parameter, thus reducing the
number of faces, edges, and vertices.
  This results in a drastic reduction of the total number of degrees of freedom
associated with a discrete problem defined over the mesh with the VEM, in
particular, for high-order formulations.
  We show how the VEM convergence rate is preserved in the optimized meshes,
and the approximation errors are comparable with those obtained with the
original ones.
  We observe that the optimization has a regularization effect over low-quality
meshes, removing the most pathological elements.
  This regularization effect is evident in cases where the original meshes
cause the VEM to diverge, while the optimized meshes lead to convergence.
  We conclude by showing how the optimization of a real CAD model can be used
effectively in the simulation of a time-dependent problem.
