Using an expression holder as a variable

I faced the problem. Could someone please clarify it for me?

I have an LPP where the objective function is made of an expression.
For example,
There’s a variable s(N) which is calculated as,
s1(t+1) = s1(t)+x+y -------- (1<=t<=N) -----------(1)

s2(t+1) = s2(t)+x+y -------- (1<=t<=N) -----------(2)

Therefore s(t+1) needs to be an expression

But my objective function is

maximize (s1(N+1)+s2(N+1))------------------------(3)

This is made of expressions, not variables

So as these expressions are temporary, when I check results at the end of the calculation (after “cvx_end”), it’s
cvx_optval = 0

In other words, I need the expression holder to act also as a variable. But as it’s evident from above equations (1 and 2), s is not an independent variable. It depends on x,y. So actual variables are x,y.

It would be a great help if someone could explain how to solve this. Thank you very much

Why can’t s1 and s2 be variables? Just use equality constraints for (1) and (2).

Hi mcg, thank you very much for the answer.
I tried making S1 and S2 variables. But then I cannot do any assignment operations within the “subject to” region (i.e. s2(t+1) = s2(t)+x+y).
So I had to make them expression holders

But why do you need to do that? Why not use equality constraints there as well; e.g., s2(t+1)==s2(t)+x+y?