[AMPL 16110] for loop error

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[AMPL 16110] for loop error

1reachsalman
Hi,

I am trying to iterate in a for loop over a set but if the set is null it shows an error. Is there a way to check the set has any value in it?

Regards,

Salman

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [AMPL 16118] for loop error

AMPL mailing list
When you declare a set, initialize it with empty set. Below is an example:
set t:={};

You shouldn't get error message in loop when your set is empty.

--
Paras Tiwari
[hidden email]
{#HS:556565628-4687#}
On Sat, Apr 7, 2018 at 1:19 PM UTC, Zeyad Kassem' Via Ampl Modeling Language <[hidden email]> wrote:
Hi,

I am trying to iterate in a for loop over a set but if the set is null it shows an error. Is there a way to check the set has any value in it?

Regards,

Salman
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.