see
by the way, the function f you posted is concave to X, it can be expressd by f=(-abs(x)+x)/2+a; in cvx.
f=(-abs(x)+x)/2+a;