How to model iterative calculation?

Problems with syntax of GAMS
Post Reply
Rofice
User
User
Posts: 17
Joined: 1 year ago

How to model iterative calculation?

Post by Rofice » 6 months ago

Hi!

I want to perform calculations similar to goal seek function in Microsoft Excel. Below is the problem statement.
Let a and b are scalar and their values are below
a=2
b=10
c is a parameter and can be estimated by the following relation
c=a+b

Ofcourse value of 'c' will be 12, but I want to model syntax which change 'b' to extent that 'c' become zero.

Kind Regards,
Rofice

cladelpino
User
User
Posts: 108
Joined: 1 year ago

Re: How to model iterative calculation?

Post by cladelpino » 6 months ago

What is iterative about the problem statement ?

or:

Why isn't b = -2 the solution ?

Best

Rofice
User
User
Posts: 17
Joined: 1 year ago

Re: How to model iterative calculation?

Post by Rofice » 6 months ago

Thanks cladelpino for your reply. Let me explain aforementioned problem in another way. I am enclosing a fabricated model to explain my problem in more detail. In the below model profit comes from selling product and subtracting raw material cost. Rate of profit depends upon the selling price of product and raw material. Once profit is estimated, it is of interest to see minimum price of product at which profit become zero. This means, I need to decrease the selling price of product in such a way that my profit become zero. Currently, I am doing this in excel by using goal seek where I restrict profit to zero and vary cost of product, until given conditions are met but it is very time consuming. So, my question was how I can model this in GAMS?

scalar
Cost_product1 selling cost of product 1 dollar per kg /3/
cost_RM1 cost of raw material 1 dollar per kg /2/ ;

variable
profit profit from sellig the product
x ammount of product genreated in kg
y ammount of raw material consumed in kg
;
equation
eq_1;

eq_1.. profit=e= Cost_product1*x- cost_RM1*y;

x.lo=2; x.up=5; y.lo=1; y.up=4;

model m /all/;
solve m maximizing profit using lp;

sureshkumar
User
User
Posts: 1
Joined: 6 months ago

Re: How to model iterative calculation?

Post by sureshkumar » 6 months ago

An iteration is repeatedly recalculating a worksheet until a specific numeric condition is met. Excel cannot calculate a formula that refers to the cell – either directly or indirectly – that contains the formula.

More details visit us : java training in chennai
Suresh kumar (Digital Marketing Executive)
java training in chennai

Post Reply