parameters,null,sparse-matrix,missing-data,ampl

Instead of specifying a default value, you can work with a sparse matrix. For example: param m integer > 0; set C within {1..m,1..m}; param A{C}; data; param m := 4; param: C: A: 1 2 3 4 := 1 36 . . -2 2 . 7 3 . 3...

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

The correct syntax of a let command is let {i in I, j in J} Rest[i, j, 0] := 0; However, it will assign starting values to the variables which can change during the optimization process. If you want to make Rest[i, j, 0] always equal to zero, then you...

I'm posting a solution to this issue, as I believe that this is an issue more people will stumble upon. Basically, in order to print only non-zero values using NEOS Server write your command file (.run file) as: solve; display {j in 1.._nvars: _var[j] > 0} (_varname[j], _var[j]); ...

The two constraints will be considered simultaneously (unless you explicitly exclude one from the problem). AMPL or optimization solvers don't have the notion of time steps and the complete problem is considered at the same time, so you might need to add some linking constraints between time periods yourself to...

Stupid is what stupid does: I forgot to limit the release parameter and there were some problems with the index (e.g. initial fill level assigned too late etc.). Therefore the problem was unbounded The objective should look like this (see last line): # objective: Maximize profit maximize obj: sum{i in...

gnu,linear-programming,linear,ampl,glpk

You can do it as follows: s.t. rest: x['Persones'] >= 7; ...

Glpk uses GNU MathProg, a subset of AMPL, so given the following parameter and set declarations: set N := 1..2; param cx{i in N}; param cy{i in N}; you can read the data as follows data; param: cx cy := 1 1 2 2 3 4; Note that in this...

It seems as if the problem arose because the problem wasn't defined to be an INTEGER problem, but a LP-relaxation of an integer problem. For some reason, CPLEX doesn't seem to support the populate method for linear programs....

constraints,linear-programming,ampl

The problem is that you use the same index c name in two different indexing expressions with overlapping scope, (c,r) in GROUP and c in COUNTRY. You can rename the second index to avoid the error: subject to WITHIN_REGION{r in REGION, (c,r) in GROUP, l in LOAN_DURATION}: x[c,l] <= QUOTA[r]*sum{c2...

linear-programming,ampl,lpsolve

You should put (a link to) the liblpsolve55.so somewhere on the library search paths, for example /usr/lib: $ sudo ln -s /usr/lib/lp_solve/liblpsolve55.so /usr/lib Also make sure that you have 32-bit (x86) version of liblpsolve55.so installed. For example, on 64-bit Ubuntu you can install 32-bit version of liblpsolve55.so as follows: $...

sum,constraints,ampl,glpk,mathprog

This is just a syntax problem. The constraint should look like the following: s.t. c1: sum{i in I, j in I}(Y[i,j]) = 6; The first brackets after the name of your constraints imply that the constraint is applied to every single [I, I]. What you want is to fix the...

variables,indexing,set,linear-programming,ampl

In AMPL, you can create or define your own "sets" for valid indices and use them in your constraints. So, in your case, to avoid invalid indices, you can define a set of permissible indices: param inner_i {2..(N-1)} and loop over those when creating the constraints. The price we pay...

The constraint y[t] = 1, then y[g] = 1 for g != t, g > t can be represented in AMPL as something like: s.t. c{t in T: t != t0}: y[t + 1] >= y[t]; where t0 is the first element of set T. Note the use of >=...

You can suppress all output by redirecting it to /dev/null (or NUL on Windows) in addition to setting solver_msg to 0: option solver_msg 0; solve > /dev/null; That said, most of the solver running time is usually spent in optimization algorithms, not output....

You need to change this constraint: # Terminal vertexes constraints s.t. Pconstraint{i in P: i != 1}: sum{(i,j) in E} x[i,j] - sum{(k,i) in E} x[k,i] = -1; That's because the first node is where flows from in this flow based formulation....