Hi Deniz
You have a missing closing parenthesis for the loop:
loop(iter$continue,
I use Emacs as editor, and it shows me using different colors to indicate missing parenthesis.
I put the cursor on the parenthesis in “loop(iter†and the “(“ lights up in purple indicating a missing one.
Cheers
Renger
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of deniz
Sent: Mittwoch, 9. März 2016 03:49
To: gamsworld
Subject: Re: IF-ELSE-LOOP error code 299 and 767
Dear Renger,
I appreciate your help so much. Unfortunately, I keep getting same error.
I am attaching the rest of the code… I am not sure what is missing, but I went through it line by line hundreds time and still I cannot figure it out.
If you guide me on this, I would really appreciate it!
Regards.
set iter /iter1*iter5/;
Sets
I /025/
T /0100/
t2(t)/099/
scalar continue /1/;
parameter stepsize1;
parameter stepsize2;
scalar theta /2/;
scalar noimprovement /0/;
scalar bestbound /-INF/;
parameter gamma1(t);
parameter gamma2(t);
scalar norm1 ;
scalar norm2 ;
scalar step1 ;
scalar step2 ;
scalar upperbound;
parameter uprevious(t);
parameter uprevious1(t);
scalar deltan1;
scalar deltan2;
parameter results(iter,);
parameter
n(t)
n1(t)
;
variable bound;
*LR… bound =e=10000
bound.l=10000;
*model ldual /LR/;
- — use zero starting point
n(t2) = 0.0;
n1(t2) = 0;
display n;
display n1;
\
\
upperbound = 13904983.6260;
display upperbound;
loop(iter$continue,
*
option optcr=0;
option limrow = 0;
option limcol = 0;
*ldual.solprint = 0;
*solve ldual minimizing bound using mip;
results(iter,‘dual obj’) = bound.l;
if (bound.l > bestbound,
bestbound = bound.l;
display bestbound;
noimprovement = 0;
else
noimprovement = noimprovement + 1;
if (noimprovement > 1,
theta = theta/2;
noimprovement = 0;
);
);
results(iter,‘noimprov’) = noimprovement;
results(iter,‘theta’) = theta;
*
gamma1(t2) = 0.2;
gamma2(t2) =0.3;
norm1 = sum((t),sqr(gamma1(t)));
norm2 = sum((t),sqr(gamma2(t)));
stepsize1 = theta*(upperbound-bound.l)/norm1;
stepsize2 = theta*(upperbound-bound.l)/norm2;
results(iter,‘norm1’) = norm1;
results(iter,‘step1’) = stepsize1;
results(iter,‘norm2’) = norm2;
results(iter,‘step2’) = stepsize2;
uprevious(t) = n(t);
uprevious1(t) = n1(t);
n(t) = max(0, n(t)+stepsize1gamma1(t));
n1(t) = max(0, n1(t)+stepsize2gamma2(t));
display n,n1;
deltan1 = smax((t),abs(uprevious(t)-n(t)));
deltan2 = smax((t),abs(uprevious1(t)-n1(t)));
results(iter,‘deltan1’) = deltan1;
results(iter,‘deltan2’) = deltan2;
if( deltan1
Subject: IF-ELSE-LOOP error code 299 and 767
Dear All,
I have a question regarding if/else loop.I wrote the following statements, but I keep getting errors
299 Unexpected end of file
767 Unexpected symbol will terminate the loop - symbol replaced by )
If I write the if statement without else if part, I don’t get the error, but I want the following code for my formulation.
I appreciate your help very much.
Thank you in advance!!!
if( deltan1 < 0.01,
display ‘Converged’;
continue = 0;
else
if (deltan2 < 0.01,
display ‘Converged’;
continue = 0;
);
);
display results;
\
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.