[AMPL 18383] How to order data from data file and refer to only certain ARCs in Model

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

[AMPL 18383] How to order data from data file and refer to only certain ARCs in Model

What You See Productions
Hi, I'm new to AMPL and I just wondered 

1) How to order my costs here, I tried the ORDERED command but got a syntax error: 
param c {ARCS} default 0;        # cost of one of flow on arc(i,j)


2) How to refer to only certain arcs in my objective function or elsewhere:

set ARCS within {NODES, NODES};   # arcs in the network 


Data File:
param: c l u :=
[S1,A]  55 . 1
[S2,A]  35 . 1
[S3,B]  25 . 1


If this was SQL I guess this would be my WHERE clause so how would I do that in AMPL?  I'm trying to set a limit on cost for side A before putting the rest in B which I'm guessing means making a constraint for each but I don't know how to refer to particular rows within columns to do that.

--
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 18391] How to order data from data file and refer to only certain ARCs in Model

AMPL mailing list
See this reply to your previous post on this topic:
https://groups.google.com/d/msg/ampl/HRkAEpvD01w/oI6rsT6vDAAJ

--
Robert Fourer
[hidden email]
{#HS:802413162-38532#}
On Fri, Mar 15, 2019 at 3:42 AM UTC, Ampl Modeling Language <[hidden email]> wrote:
Hi, I'm new to AMPL and I just wondered

1) How to order my costs here, I tried the ORDERED command but got a syntax error:
param c {ARCS} default 0; # cost of one of flow on arc(i,j)


2) How to refer to only certain arcs in my objective function or elsewhere:

set ARCS within {NODES, NODES}; # arcs in the network


Data File:
param: c l u :=
[S1,A] 55 . 1
[S2,A] 35 . 1
[S3,B] 25 . 1


If this was SQL I guess this would be my WHERE clause so how would I do that in AMPL? I'm trying to set a limit on cost for side A before putting the rest in B which I'm guessing means making a constraint for each but I don't know how to refer to particular rows within columns to do that.
--
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.