Hi,--I'm new to AMPL and just need to know how you would refer to certain rows in a column like a WHERE clause in SQL?Also, do you have an example of how to sort say cost in the data below:param: c l u :=[R9,A] 55 . 1[R7,A] 35 . 1[R4,A] 45 . 1[R1,B] 54 . 1[R8,B] 37 . 1I tried using ORDERED here in the model but got a syntax error:param c {ARCS} default 0, ordered;
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 ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Thanks, I just wondered if there was an easy way to sort each column. If I wanted to refer to a particular node or arc in a binary variable how would I do that? I tried their example and below to switch it on if this node gets hit with no luck:
var Use {ORIG,DEST} binary;
Is {ORIG,DEST} not the name of the ARC? I'm just wanting a 1 if the node gets hit at all in the program sort of like a WHERE clause in SQL.
var Use {(i,j) in ARCS: i = 'ARC-or-NODE-Name?'} binary
On Fri, Mar 15, 2019 at 6:32 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
You can include a condition in the indexing set. For example:
{(i,j) in ARCS: i != j}
{(i,j) in ARCS: cost[i,j] <= limit}
{(i,j) in ARCS: i != j and cost[i,j] <= limit}
AMPL does not have a concept of ordered params. You can sometimes write an AMPL script to sort values, but the details depend on what you are trying to do. What is the context in which you need to sort the arcs by cost?
--
Robert Fourer
am...@googlegroups.com