The following function has its origin in multicriteria optimization.
$$p(x)=\max\{1_n^{\top}(Cy-Cx): Cy \geq Cx, y \in X\},$$
where $C$ is a $p \times n$ matrix and $X$ is a convex polyhedral set, $\geq$ is meant in the pointwise sense and $1_n = (1,1,\ldots, 1)$.
It is a non-differentiable function. I read in an paper that to calculate a subgradient of this function, one writes first the dual of the problem and then calculates a subgradient of this dual. But since I'm not too familiar with convex analysis, I did not understand why we need the dual and is it possible to calculate directly?