Dear Pang,
As stated, your problem is unbounded (just take x_i to infinity), but I guess you do have some bounds.
The positive part is easy, just introduce
y_i >= 0
y_i >= x_i
and substitute \phi(x_i) with y_i
now, for lambda(x,a) you have a problem; since all number operations are carried on in floating point precision, you MUST use a tolerance (epsilon) for the comparison x == a and use instead ABS(x-a) < epsilon
such an epsilon can not be smaller than the value of InfTol parameter.
the, to express lambda(x_i,a_i) you could the following:
z_i binary
z_i = 1 -> ABS(x_i - a_i ) >= epsilon
and substitute lambda(x_i,a_i) with z_i
Hope it helps,
Best
Daniel