```
cvx_clear
cvx_begin quiet
cvx_solver mosek
variable X(N,K) binary
expression WPT(1,N)
expression trans(K)
maximize sum(sum(X.*S)) % maximize sum(trans)
subject to:
WPT(1,1)=0;
for m=2:N
WPT(1,m)=WPT(1,m-1)+1*delta_t*R2(1,m);
Ef(1,m)-WPT(1,m)<=E0;
end
for k=1:K
trans(k)=0;
for m=1:N
trans(k)=trans(k)+X(m,k)*S(m,k);
end
trans(k)>=D(k);
end
for m=1:N
sum(X(m,:))<=1;
end
cvx_end
```

**maximize sum(sum(X. S)) and maximize sum(trans) have different results*