Page 1 of 1

How to implement the recurrence equation in GAMS?

Posted: Fri Jan 19, 2024 6:34 am
by minegams

Code: Select all

$title mytestmodel

Set
   t 'time' / t1*t10 /
   i 'paper'   / i1 /;


Variable
   p(t,i) 'learned probability at time t about paper i'

Binary Variable  a(t,i) 'action at time t about i';

Equation
   upd(t,i)   'transition equation for p'


upd(t,i)..                     p(t,i)=e=((p(t-1,i)+(1-p(t-1,i))*0.7)*a(t,i)+(1-a(t,i))*p(t-1,i)*p0(t-1,i));

Model my modell /all/;
this code gives me a lot of errors especially around `

Code: Select all

p(t,i)=e=((p(t-1,i)+(1-p(t-1,i))*0.7)*a(t,i)+(1-a(t,i))*p(t-1,i)*p0(t-1,i));
I would like to solve optimal control problem in gams,but how to define the equations like

Code: Select all

p(t)=func(p(t-1))
????

Re: How to implement the recurrence equation in GAMS?

Posted: Wed Jan 24, 2024 6:01 am
by GabrielYin
Your way of modeling recurrence equation is OK. It's just a lot of syntax you missed out.

1. You need a semicolon to close the equation definition.
2. You need to define p0.

Best,
Gabriel