enhany75
unread,Feb 12, 2009, 1:13:54 PM2/12/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to AMPL Modeling Language
I am using the break command to terminate a repeat loop. The problem
is that the loop is terminated for some problem instances and not for
others even when the break condition is satisfied (deviation_2 =
Alpha ). I spent too much time to find the reason for that but I
couldn't. Could you please help.
Here is the code:
repeat {
for {j in t1} {let Lj_value[j] := Lj[j];}
for {k in t2} {let Lk_value[k] := Lk[k];}
for {j in t1, k in t2} {let Ljk_value[j, k] := Ljk[j,k];}
solve sub_problem;
if sub_problem.result= "infeasible" then {
let nsoln:= nsoln +1;
for {j in t1} {let Ljinf[nsoln,j] := Lj[j];}
for {k in t2} {let Lkinf[nsoln,k] := Lk[k];}
}
else if sub_problem.result = "solved" then {
let nsoln2:= nsoln2 +1;
for {j in t1} {let Ljm[j, nsoln2] := Lj[j];}
for {k in t2} {let Lkm[k, nsoln2] := Lk[k];}
for {j in t1, k in t2} {let Ljkm[j, k, nsoln2] := Ljk[j,k];}
for {j in t1} {let Lamba[j, nsoln2]:= Lj_values[j].dual;}
for {k in t2} {let Mue[k, nsoln2]:= Lk_values[k].dual;}
for {j in t1, k in t2} {let Gama[j,k,nsoln2]:= Ljk_values[j,k].dual;}
let deviation[nsoln2]:= deviation_2;
display deviation_2;
display Alpha;
if deviation_2 = Alpha then break;
}
if nsoln2 = 0 then {solve master_problem_feasible;
if master_problem_feasible.result= "infeasible" then break;}
else if nsoln2 > 0 then {solve master_problem;
if master_problem.result= "infeasible" then break;}
}