Page 1 of 1

Display costs of Summands after solving model

Posted: Mon Jun 27, 2022 11:30 am
by mikelusian
Good morning and greetings from spain!

My name is Mike Lusian and I currently study and work at the Autonomous University of Barcelona. This is my first post in this forum. In the last weeks I learned how to model with GAMS.
However I have a question regarding the display of equations.

What you look at is a part of my goal function (the goal function itself is not important):

Goal =e= sum((k,l,p), B(k,l,p)*v(q,w)) + sum((g,k,p), T(g,k,p)*v(q,w)) + sum((r,u,p), O(r,u,p)*v(q,w))

Is it possible to display the costs of each summand? For example I want to display something like this after solving the model:

sum((k,l,p), B(k,l,p)*v(q,w)) = 213876.378
sum((g,k,p), T(g,k,p)*v(q,w)) = 9271.342
sum((r,u,p), O(r,u,p)*v(q,w) )= 128972.993

Or is there any other way how I can see how costly each individual summand is?

Thanks in advance and nice to meet you!

Re: Show Cost of Summands after solving model

Posted: Mon Jun 27, 2022 11:37 am
by bussieck
You will need to program this. For example:

Code: Select all

Goal1 =e= (sum((k,l,p), B(k,l,p)*v(q,w));
Goal2 =e= sum((g,k,p), T(g,k,p)*v(q,w));
Goal3 =e= sum((r,u,p), O(r,u,p)*v(q,w));
Goal =e= Goal1 + Goal2 + Goal3;
...
display Goal1.l, Goal2.l,Goal3.l;
-Michael

Re: Display costs of Summands after solving model

Posted: Mon Jun 27, 2022 11:56 am
by mikelusian
Thank you it works!