Consider the following two programs,

\begin{align}

max &~f(x) \

\textrm{s.t.} & ~x\in X.

\end{align}

and

\begin{align}

min &~f(x) \

\textrm{s.t.} & ~x\in X.

\end{align}

where X is a compact convex set and f(x) is nicely linear.

Question:

Is it possible for us to optimize these two programs within one ‘cvx-’ block to avoid declaring redudant constraints and variables?