Re: [AMPL 11995] Reading sets from .txt

12 views
Skip to first unread message

Victor Zverovich

unread,
May 23, 2016, 12:34:47 PM5/23/16
to am...@googlegroups.com
The easiest way is to use the AMPL data statements, for example:

data;
set R := R1 R2 ...

where R1, R2, ... are members of set R. Another option is to use the read command. See also Chapter 9. Specifying Data of the AMPL book.

HTH,
Victor

On Sun, May 22, 2016 at 4:55 PM Steffen <brat...@gmail.com> wrote:
Hi.

I have a model with some very large sets, and would like AMPL to read the sets from .txt-files.
The sets:

set P; #production plants
set W; #warehouses
set R; #retailers (more than 4'600)
set I := P union W; #all predecessor nodes
set S := W union K; #all successor nodes
set X{S}; #predecessor nodes for node s
set Y{I}; #successor nodes for node i

If e.g. I'd want to read set R from a .txt file, how would I write it?

I have tried to read the sets from .xlsx tables, but I run a 64-bit AMPL and 32-bit Excel, which gave me some trouble.

Thanks.

--
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.
Reply all
Reply to author
Forward
0 new messages