use the optimization output problem as input parameters to solve an equation and then input the equations output to solve the optimization problem

hi
I am a beginner in gams. I write a program in gams to solve an optimization problem . and then use the output in an equation to calculate the price. in continue I should put the outputs as an input parameters to solve the optimization problem and continue this iteration until the optimization problem converge.

for example :
I solve the problem and get the following results:
benefit = 250
g1=10
g2=20

and then put the g outputs in to the equation and get the price as follows
price(1,1) =2
price(1,2)=3

now I want to use these data as an input parameters that I specified them before as an initialprice and now I want to upgrade these initial price with these new results and then solve my model with them.

could you please help me ?
regards

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\

Hi
You may want to try something like this :
Define a set over which you will iterate.

SET ITER / i00 * i10 / ;


and a controlling scalar :

SCALAR CONTINUE / 1 / ;


Then define your full model as you did, except that you will encapsulate the SOLVE statement in a iterative loop, like in this piece of pseudo-gams code :

LOOP(ITER $(CONTINUE > 0),

  • solve the problem :

SOLVE …

  • compute the new initial prices :

PRICE = …

  • test for convergence :

IF (…, CONTINUE = 0 ; );

);


Hope this helps
cheers
dax









Le dimanche 21 juillet 2013 19:00:50 UTC+2, m asgary a écrit :

hi
I am a beginner in gams. I write a program in gams to solve an optimization problem . and then use the output in an equation to calculate the price. in continue I should put the outputs as an input parameters to solve the optimization problem and continue this iteration until the optimization problem converge.

for example :
I solve the problem and get the following results:
benefit = 250
g1=10
g2=20

and then put the g outputs in to the equation and get the price as follows
price(1,1) =2
price(1,2)=3

now I want to use these data as an input parameters that I specified them before as an initialprice and now I want to upgrade these initial price with these new results and then solve my model with them.

could you please help me ?
regards

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\

Dear dax
thanks a lot for your consideration
actually , I solve my program with initial price that I call (ini_pi) in my program. the out put of the optimization problem are the generation and the maximum benefits of each firm.
then I want to determine the price again with the demand function and replace it with the ini_pi to solve my optimization problem again.

Now I want to complete my program to do this iterative process automatically for 10 iteration.
I attach a program to this email.
could please help me to do this .
thanks in advance



On Tuesday, July 23, 2013 4:07:44 PM UTC+8, dax wrote:

Hi
You may want to try something like this :
Define a set over which you will iterate.

SET ITER / i00 * i10 / ;


and a controlling scalar :

SCALAR CONTINUE / 1 / ;


Then define your full model as you did, except that you will encapsulate the SOLVE statement in a iterative loop, like in this piece of pseudo-gams code :

LOOP(ITER $(CONTINUE > 0),

  • solve the problem :

SOLVE …

  • compute the new initial prices :

PRICE = …

  • test for convergence :

IF (…, CONTINUE = 0 ; );

);


Hope this helps
cheers
dax









Le dimanche 21 juillet 2013 19:00:50 UTC+2, m asgary a écrit :

hi
I am a beginner in gams. I write a program in gams to solve an optimization problem . and then use the output in an equation to calculate the price. in continue I should put the outputs as an input parameters to solve the optimization problem and continue this iteration until the optimization problem converge.

for example :
I solve the problem and get the following results:
benefit = 250
g1=10
g2=20

and then put the g outputs in to the equation and get the price as follows
price(1,1) =2
price(1,2)=3

now I want to use these data as an input parameters that I specified them before as an initialprice and now I want to upgrade these initial price with these new results and then solve my model with them.

could you please help me ?
regards

\

test 002.gms (3.89 KB)

dear mohammad,

before trying to iterate over price levels, I think you should consider verifying the “physical” modelling first. it looks a little weird.
further, you do not mention how you intend to update your price – is it the MCPS parameter ?
if so, you just have to apply the pseudo-code I was mentioning yesterday, which yields something like :

*-----------------------------------
model mohammad /all/;
parameter MCPS(s,l);

set iter /it01*it10/ ;
loop(iter,

solve mohammad using NLP maximazing tprofit;
loop ((s,l),MCPS(s,l) =
-(sum(e,g.l(e,s,l))/refpi(s,l))+(refdem(s,l)/refpi(s,l));
if (MCPS(s,l) 0),

  • solve the problem :

SOLVE …

  • compute the new initial prices :

PRICE = …

  • test for convergence :

IF (…, CONTINUE = 0 ; );

);


Hope this helps
cheers
dax









Le dimanche 21 juillet 2013 19:00:50 UTC+2, m asgary a écrit :

hi
I am a beginner in gams. I write a program in gams to solve an optimization problem . and then use the output in an equation to calculate the price. in continue I should put the outputs as an input parameters to solve the optimization problem and continue this iteration until the optimization problem converge.

for example :
I solve the problem and get the following results:
benefit = 250
g1=10
g2=20

and then put the g outputs in to the equation and get the price as follows
price(1,1) =2
price(1,2)=3

now I want to use these data as an input parameters that I specified them before as an initialprice and now I want to upgrade these initial price with these new results and then solve my model with them.

could you please help me ?
regards

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\

Dear Dax
Thanks a lot for your favor.
in my model the MCPS is the same as ini_pi that you mentioned correctly in the above pseudo code just I want to clarify the MCPS as an output for my program. but I have the problem that the tprofit does not converge to a specific value and after 4 or 5 iteration the tprofit value fluctuate between 2 values . for example fluctuate between 4.59E8 and 1.103e8 and never converge to a specific value . and now I want to determine the maximum tprofit as an output of my program. I test this condition for several initial price (ini_pi) and I found that after 4 or 5 iteration these values are repeated until the end of the iteration that has been determined for the loop. Could you please help me that how could I define it for my program?
it means that after solve the loop problem automatically found the maximum profit after the 5 iteration, and also save and keep it ?
it means If (iter>5,then put tprofit=max )
thanks a lot for your favor in advance
regards
Mohammad

On Wednesday, July 24, 2013 4:49:27 PM UTC+8, dax wrote:

dear mohammad,

before trying to iterate over price levels, I think you should consider verifying the “physical” modelling first. it looks a little weird.
further, you do not mention how you intend to update your price – is it the MCPS parameter ?
if so, you just have to apply the pseudo-code I was mentioning yesterday, which yields something like :

*-----------------------------------
model mohammad /all/;
parameter MCPS(s,l);

set iter /it01*it10/ ;
loop(iter,

solve mohammad using NLP maximazing tprofit;
loop ((s,l),MCPS(s,l) =
-(sum(e,g.l(e,s,l))/refpi(s,l))+(refdem(s,l)/refpi(s,l));
if (MCPS(s,l) 0),

  • solve the problem :

SOLVE …

  • compute the new initial prices :

PRICE = …

  • test for convergence :

IF (…, CONTINUE = 0 ; );

);


Hope this helps
cheers
dax









Le dimanche 21 juillet 2013 19:00:50 UTC+2, m asgary a écrit :

hi
I am a beginner in gams. I write a program in gams to solve an optimization problem . and then use the output in an equation to calculate the price. in continue I should put the outputs as an input parameters to solve the optimization problem and continue this iteration until the optimization problem converge.

for example :
I solve the problem and get the following results:
benefit = 250
g1=10
g2=20

and then put the g outputs in to the equation and get the price as follows
price(1,1) =2
price(1,2)=3

now I want to use these data as an input parameters that I specified them before as an initialprice and now I want to upgrade these initial price with these new results and then solve my model with them.

could you please help me ?
regards

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\