[AMPL 1613] New to AMPL Syntax Question

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

[AMPL 1613] New to AMPL Syntax Question

Awesome Adam

I am new to the AMPL language and am trying to model something, but I
continually get syntax errors on code that I feel should be right.
This is one line of code that continues to give me a syntax error
message:

time_limits {i in T, j in S, k in M}:
    sum{ i in T} (sum{ j in 1..S} (sum{ k in M} c[i, k]*x[i, j, k]))
<= L[j];

Can someone more familiar with the language please tell me why this
does not work.

Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

[AMPL 1615] Re: New to AMPL Syntax Question

Hans Mittelmann

Hi,
in the first line S eeems to be a set and in the second an integer.

On Feb 15, 12:06 pm, Awesome Adam <[hidden email]> wrote:

> I am new to the AMPL language and am trying to model something, but I
> continually get syntax errors on code that I feel should be right.
> This is one line of code that continues to give me a syntax error
> message:
>
> time_limits {i in T, j in S, k in M}:
>     sum{ i in T} (sum{ j in 1..S} (sum{ k in M} c[i, k]*x[i, j, k]))
> <= L[j];
>
> Can someone more familiar with the language please tell me why this
> does not work.
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

[AMPL 1616] Re: New to AMPL Syntax Question

Robert Fourer-2


Also, you can't index the whole constraint over "i in T" and then have a sum
inside the constraint that's also over "i in T" -- and similarly for j and
k.  I think that most likely what you had in mind was

   time_limits {j in S}:
      sum {i in T} sum {k in M} c[i,k] * x[i,j,k] <= L[j];

But it's hard to tell for sure without a description in words of what you
want the constraint to mean.

Bob Fourer
[hidden email]


> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of
> Hans Mittelmann
> Sent: Friday, February 15, 2008 5:18 PM
> To: AMPL Modeling Language
> Subject: [AMPL 1615] Re: New to AMPL Syntax Question
>
> Hi,
> in the first line S eeems to be a set and in the second an integer.
>
> On Feb 15, 12:06 pm, Awesome Adam <[hidden email]> wrote:
> > I am new to the AMPL language and am trying to model something, but I
> > continually get syntax errors on code that I feel should be right.
> > This is one line of code that continues to give me a syntax error
> > message:
> >
> > time_limits {i in T, j in S, k in M}:
> >     sum{ i in T} (sum{ j in 1..S} (sum{ k in M} c[i, k]*x[i, j, k]))
> > <= L[j];
> >
> > Can someone more familiar with the language please tell me why this
> > does not work.
> >
> > Thanks





--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

[AMPL 1620] Re: New to AMPL Syntax Question

Awesome Adam

Thank you so much. I just started using ampl about a week ago and am
getting caught on the most common sense stuff. I appreciate the
replies. They were very helpful. Thanks

On Feb 15, 8:17 pm, "Robert Fourer" <[hidden email]> wrote:

> Also, you can't index the whole constraint over "i in T" and then have a sum
> inside the constraint that's also over "i in T" -- and similarly for j and
> k.  I think that most likely what you had in mind was
>
>    time_limits {j in S}:
>       sum {i in T} sum {k in M} c[i,k] * x[i,j,k] <= L[j];
>
> But it's hard to tell for sure without a description in words of what you
> want the constraint to mean.
>
> Bob Fourer
> [hidden email]
>
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]] On Behalf Of
> > Hans Mittelmann
> > Sent: Friday, February 15, 2008 5:18 PM
> > To: AMPL Modeling Language
> > Subject: [AMPL 1615] Re: New to AMPL Syntax Question
>
> > Hi,
> > in the first line S eeems to be a set and in the second an integer.
>
> > On Feb 15, 12:06 pm, Awesome Adam <[hidden email]> wrote:
> > > I am new to the AMPL language and am trying to model something, but I
> > > continually get syntax errors on code that I feel should be right.
> > > This is one line of code that continues to give me a syntax error
> > > message:
>
> > > time_limits {i in T, j in S, k in M}:
> > >     sum{ i in T} (sum{ j in 1..S} (sum{ k in M} c[i, k]*x[i, j, k]))
> > > <= L[j];
>
> > > Can someone more familiar with the language please tell me why this
> > > does not work.
>
> > > Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---