What is your error exactly? From a first look I would say that ther should be a problem with your variables c(ii,a,t+(ord(a)-1)) and l(ii,a,t+(ord(a)-1)) beause they are defined in the sets (ii,a,t). So for example when t reaches its last element, the variable c(ii,a,t+(ord(a)-1)) should not exist. You could probably fix this problem if you replace you equation with the following:

utility(ii,t)$(ord(t) le card(a)-1).. u=e=(1/(1-1/gamma))*sum(a,S(a)*(beta**(ord(a)-1))*([c(ii,a,t+(ord(a)-1))**(1-1/rho)+alpha*l(ii,a,t+(ord(a)-1))**(1-1/rho)]**(1/(1-1/rho)))**(1-1/gamma));