Objective Function Problem:
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?
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).
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.
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)?
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.
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:
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:
Thank you so much!
Reply
Sign up
Already have an account? Login
Please use your business or academic e-mail address to register
Login to the community
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.