Thanks to Mr. Fourer for his great book and his great helps. My mixed integer linear problem has been solved and I have switched to a nonlinear one. I have two sets as: set BUSES; set LINES within {i1 in BUSES, i2 in BUSES: i1 <> i2}; and the related variable is: var Phi {LINES}; subject to active_power_flow_equation {i1 in BUSES}: Pg[i1] + delta_Pg_Inc[i1] - delta_Pg_Dec[i1] - Pd[i1]= sum {i2 in BUSES} V[i1] *V[i2]*(Gmatrix[i1,i2]*cos(delta[i1]-delta[i2]+Phi[i1,i2]) + Bmatrix[i1,i2]*sin(delta[i1]-delta[i2]+Phi[i1,i2])); There is no line between some buses like one-one or one- five, therefore ‘’invalid subscript Phi[‘one’ , ‘one’]’’ error occurs. I think an ‘if …then’ expression is needed in the constraint to set Phi [i1,i2] to zero for those undefined pairs [i1,i2]. How can I solve this problem? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
Instead of "sum {i2 in BUSES}" you should write "sum {(i1,i2) in LINES}" -- section 6.2 of the AMPL book explains summing over "slices" through sets of pairs in this way. Bob Fourer [hidden email] > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] > On Behalf Of mah > Sent: Monday, December 22, 2008 8:30 PM > To: AMPL Modeling Language > Subject: [AMPL 2135] undefined pairs > > > Thanks to Mr. Fourer for his great book and his great helps. > My mixed integer linear problem has been solved and I have switched to > a nonlinear one. > > I have two sets as: > > set BUSES; > set LINES within {i1 in BUSES, i2 in BUSES: i1 <> i2}; > > and the related variable is: > > var Phi {LINES}; > > subject to active_power_flow_equation {i1 in BUSES}: Pg[i1] + > delta_Pg_Inc[i1] - delta_Pg_Dec[i1] - Pd[i1]= sum {i2 in BUSES} V[i1] > *V[i2]*(Gmatrix[i1,i2]*cos(delta[i1]-delta[i2]+Phi[i1,i2]) > + Bmatrix[i1,i2]*sin(delta[i1]-delta[i2]+Phi[i1,i2])); > > There is no line between some buses like one-one or one- five, > therefore ''invalid subscript Phi['one' , 'one']'' error occurs. > I think an 'if .then' expression is needed in the constraint to set Phi > [i1,i2] to zero for those undefined pairs [i1,i2]. > How can I solve this problem? > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
Free forum by Nabble | Edit this page |