Solved

Objective Function Problem:

  • 27 May 2019
  • 3 replies
  • 1067 views

Hi, the "objective function" of my program is read as a variable in AIMMS. All the parameters in the objective function already have a data read from excel. My problem is, AIMMS keeps on saying "the scope of index i has not been specified" when I try to specify the index, the program won't run because it will say that the objective function should be a free scalar variable. What should I do?

icon

Best answer by Gertjan 27 May 2019, 16:16

View original

3 replies

Thank you so much!
Userlevel 6
Badge +6
Seems you are still missing a sum(i, as you have a variable tt(i,j) and the objective needs to become scalar variable. If you open the error (red cross), it should highlight the exact point. In a reproduced similar problem (different model as I do not have yours), this looks like:



BTW (if I may): Looking at some of your identifiers and specifically constraints, you might want to give them some more self-explanatory names (you did that for Sets). This will make the model easier to read and debug (e.g. saying Constraint_12 is infeasible is less intuitive than calling it RespectDemand). Same for objective, is this a Cost, Revenue or so? Also, when you come back later, you are able to read the model-tree and understand what the model does. Just as an illustration:

Userlevel 5
Badge +2
Hi @pamjsnn.

Taking a quickly glance at your model, the basic answer is that you can't have a free index (i,j) within your objective function, i.e., you need to use a function to iterate over these indexes if you specify them.

But, in order to give you a complete answer I would need to understand the relation between your variable x(v,k) and the parameter tt(i,j).
  • is tt the transit time between i and j?
  • is k a pair (i,j)?
If so, you could calculate tt(i,j) to tt_calc(k) and use within your statement.

I noticed that you are using min(P) but none of your parameters nor variables depend on it.

Maybe other community member could help you better.

Reply


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

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