  We consider a class of infinite-dimensional optimization problems in which a
distributed vector-valued variable should pointwise almost everywhere take
values from a given finite set $\mathcal{M}\subset\mathbb{R}^m$. Such hybrid
discrete--continuous problems occur in, e.g., topology optimization or medical
imaging and are challenging due to their lack of weak lower semicontinuity. To
circumvent this difficulty, we introduce as a regularization term a convex
integral functional with an integrand that has a polyhedral epigraph with
vertices corresponding to the values of $\mathcal{M}$; similar to the $L^1$
norm in sparse regularization, this "vector multibang penalty" promotes
solutions with the desired structure while allowing the use of tools from
convex optimization for the analysis as well as the numerical solution of the
resulting problem.
  We show well-posedness of the regularized problem and analyze stability
properties of its solution in a general setting. We then illustrate the
approach for three specific model optimization problems of broader interest:
optimal control of the Bloch equation, optimal control of an elastic
deformation, and a multimaterial branched transport problem. In the first two
cases, we derive explicit characterizations of the penalty and its generalized
derivatives for a concrete class of sets $\mathcal{M}$. For the third case, we
discuss the algorithmic computation of these derivatives for general sets.
These derivatives are then used in a superlinearly convergent semismooth Newton
method applied to a sequence of regularized optimization problems.
  We illustrate the behavior of this approach for the three model problems with
numerical examples.
