setamplneos-server

setof in model data and script files for NEOS server


In submitting my AMPL formulation to the NEOS server, why does the below codeline using the `setof' operator work fine in a model file but not in a data file?

set X := setof {indices in Y} subsetofindices

The NEOS server requires the code be separated into a .mod , .dat, and script file separately. I've seen references to use let X := ... in the script file. What is the difference between these files, and what to put where?

Example Using AMPL's steelT.x files, this first block of 2 files works

# steelT.mod
set DUMMYPROD;
set PROD := setof {i in DUMMYPROD} i;     # products
# steelT.dat
data;
set DUMMYPROD := bands coils;

Whereas the following does not work:

# steelT.mod
set DUMMYPROD;
set PROD;     # products
# steelT.dat
data;
set DUMMYPROD := bands coils;
set PROD := setof {i in DUMMYPROD} i;

It returns the error

expected ; ( : or symbol context: set PROD := setof >>> { <<< i in DUMMYPROD} i;

Broader question Generally, what belongs in the model file, data file and script file? (Also for param and other definitions) What is the order in which these are processed? I may be missing some basics as I read the AMPL guide where I did not find this (I never took an Optimization course).

Bonus question about NEOS server "New" Contraint programming logic in AMPL includes conditional and logical operators for entire constraints. I don't think these are available in NEOS. Or are they (because they didn't work for me)? Is there a simple workaround?

Thanks!


Solution

  • AMPL data format doesn't support expressions, so you should either use setof {i in DUMMYPROD} i in the declaration (as in your first example) or in the AMPL script:

    let PROD := setof {i in DUMMYPROD} i;
    

    See also Chapter 9. Specifying Data of the AMPL book for more details on the AMPL data format.

    As for the constraint programming (CP) features, I don't think there are any CP solvers on NEOS. You can try contacting NEOS Support regarding this.