Display costs of Summands after solving model

Problems with modeling
Post Reply
mikelusian
User
User
Posts: 3
Joined: 1 year ago

Display costs of Summands after solving model

Post 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!
Last edited by mikelusian 1 year ago, edited 1 time in total.
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Show Cost of Summands after solving model

Post 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
mikelusian
User
User
Posts: 3
Joined: 1 year ago

Re: Display costs of Summands after solving model

Post by mikelusian »

Thank you it works!
Post Reply