Problem modelling zero stock constraint

  • 22 November 2022
  • 2 replies


Dear all,

I’m new to AIMMS, and a Newbie to Operations Research at all.

I’m working on a seminar paper in regards to transportation planning for university. Therefore I try to model a slimmed down model of the model enclosed. I dismissed the manufacturing echelon.


At the moment im dealing with the 0-Stock constraint.

I can’t put it into AIMMS without getting either message:

  • The scope of index "w" has not been specified.
  • The index "w" already has a scope.

In the paper enclosed it’s defined as:

see page 6674 Mari et. al 2014



However, because I don't have manufacturing, I modeled the constraint as follows:


TQSW_swvp: Transport quantity from supplier s to transshipment warehouse w with transport vehicle v at period p

TQWC_wcvp: Transport quantity from transshipment warehouse w to customer c with transport vehicle v at period p


What am I doing wrong?

I appreciate your effort.


Thansk in advance.


2 replies

Userlevel 5
Badge +7

The index domain means that AIMMS will generate one actual constraint line for every combination of these indices.


One of the problems you have is that in the second sum, you are summing over the same index w that you are using in the index domain. That means in a constraint that is generated for a specific (w,p) combination, the w is already bound to one value. You can then not use w again in a sum.

If you want to do an actual sum over all of the elements of the set that w belongs to, you would need need to define a second index w2 in the same set that w belongs to and use that in the sum statement.

The second problem with your second sum is that you are using the index c, but you are not telling aimms how to use it: it is not bound to a value because of being in the index domain and it is also not defined within for example the sum statement.


You have to read the sum( w, someValue(w) )  as  sum the values of someValue(w) for all combinations of w.

However, if you do something like this     sum( w, someOtherValue(w,c) ) you read this as   sum the values of someOtherValue(w,c) for all combinations of w. At this point, the c index never gets a specific value that it points to.


Thank you for your response… But then there might be something within the original paper.

All i did is merging both constraints together because i don’t have manufacturing in my modell.

I might check additional literature, probably this helps.


However thank you very much for your support.


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator