Question about summation

  • 1 July 2019
  • 2 replies

Dear all,

I have a few questions about my model, which I hope the AIMMS community can answer. Please bear with me, as I should be drawing to the conclusion of my thesis (when this model works).

Sum and indices
In the accompanied model, I am trying to add several constraints. However, when setting these constraints I often encounter errors like "the index (p) does not denote a subset of the domain of set "FactoryLines"" for instance.

I often find that I make mistakes with the indices in the constraint itself and within the constraint definition. I have tried looking at the guides online, but with no effect. Could anyone explain to me (preferably in layman's terms) how the indices in constraints work as well as indices within a sum argument? I am encountering similar problems with the parameters "IncomingStock" and "OutgoingStock"

Stock balancing
One of the decision variables, StockAtWarehouse is made from the following definition:

StockAtWarehouse(p,w,t-1) + sum(p, IncomingStock(w,p,t)) - sum(p, OutgoingStock)

I am afraid that for t = 1, the formula will not work since it is referring to a time unit that is not in the set. I tried to include an if statement, that states that it should replace the StockAtWarehouse(p,w,t-1) with the parameter StartingStock if t = 1, but this has not worked for me yet. Could anyone look at the code and point out to me what I am doing wrong? Moreover, would this be a right approach for a problem like this, or would you recommend something else?

Production constraint
For my model, a product can be produced or not. IF it is produced, a minimum lotsize of 10.000 kg must be produced. I created the variable ProductInFactory, but I am not sure how to continue from there. Should I make a constraint, and if so, what could it possibly look like?

General solvability
I have not yet been able to solve this model properly, but do you have any tips on my model that may enhance its quality or make it easier to solve? I am still very much a beginner in AIMMS, and I wish to get better but I find the learning curve quite steep so far.

Sorry for the avalanche of questions, kind regards.


Best answer by mohansx 4 July 2019, 02:23

View original

2 replies

Userlevel 5
Badge +5

In the project you attached, most of the variables had the range "Free". All of these variables should have range as "nonzero" and you had other problems with index domains.

I fixed the errors and the model is able to solve now. However, it is infeasible because there isn't enough capacity for some of the products.

See data of DemandCheck(p, t) with negative values. I subtract the total demand of product p in time t from the total available capacity in that time period - ProductionCapability*ProductionCapacity. This is causing the problem to be infeasible. So, you either check your input data or allow for customers to have unfulfilled demand.

Download project from

Use the casefile aimmscase
Userlevel 6
Badge +6
Hi @KoenV , just wondering if this thread answered your question, or you found another solution? Would you mind to mark what is the "best answer"? (It helps others understand what to do if they have similar problem.)

Thanks 🙂


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

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