Hi Renger,

Thanks a lot for your answer. The model did not give any syntax error after your correction.

But now, the code exits with code 3 which is error for division by 0. However, I checked whole code, the paranthesis, defined parameters and their values many times. Any of them should not cause such a division. And also I write constraints for k=1 and k=3 by hand. The constraint for k=1 is generated properly, while the constraint for k=3, is not generated properly. In the previous answer, you stated there exist some additional error. I think I corrected them, but may be I missed one error. And that error causes wrong constraint generations. The final version of the constraints is below. The only part I changed in the previous code is these constraints.

Could you check them? Is there any other error which I could not recognize?

Thanks a lot again and again.

class1(k)(mapK_I(k,'1')).. sum(j, sum(s(ord(s)<=r(k,j)-1), w(j,s))) + sum((j,s),w(j,s)(ord(s)=r(k,j))*((a(k,j)-aa(j,s)(ord(s)=r(k,j)))/(aa(j,s)(ord(s)=(r(k,j)-1))-aa(j,s)(ord(s)=r(k,j))))) - u(‘1’) + epsplus(k) =g= 0.0001 ;

class2plus(k)(mapK_I(k,'2')).. sum(j, sum(s(ord(s)<=r(k,j)-1), w(j,s))) + sum((j,s),w(j,s)(ord(s)=r(k,j))*((a(k,j)-aa(j,s)(ord(s)=r(k,j)))/(aa(j,s)(ord(s)=(r(k,j)-1))-aa(j,s)(ord(s)=r(k,j))))) - u(‘2’) + epsplus(k) =g= 0.0001 ;

class2minus(k)(mapK_I(k,'2')).. sum(j, sum(s(ord(s)<=r(k,j)-1), w(j,s))) + sum((j,s),w(j,s)(ord(s)=r(k,j))*((a(k,j)-aa(j,s)(ord(s)=r(k,j)))/(aa(j,s)(ord(s)=(r(k,j)-1))-aa(j,s)(ord(s)=r(k,j))))) - u(‘1’) - epsminus(k) =l= -0.0001 ;

class3(k)(mapK_I(k,'3')).. sum(j, sum(s(ord(s)<=r(k,j)-1), w(j,s))) + sum((j,s),w(j,s)(ord(s)=r(k,j))*((a(k,j)-aa(j,s)(ord(s)=r(k,j)))/(aa(j,s)(ord(s)=(r(k,j)-1))-aa(j,s)(ord(s)=r(k,j))))) - u(‘2’) - epsminus(k) =l= -0.0001 ;