define Sets in ALM problem

Problems with syntax of GAMS
Post Reply
mr_khdm
User
User
Posts: 4
Joined: 7 months ago

define Sets in ALM problem

Post by mr_khdm » 3 months ago

Hello
about multi-stage stochastic programming for Asset and Liability Management (ALM) Model I have questions:

Image

for t=1 and t=2 we have this Eq.

Image

and I coded this Eq. :

Code: Select all

co2(s,t)$(ord(t)>=1 and ord(t)<3) .. sum(i,r(i,t,s) * x(i,t-1,s)) =e= sum(i,x(i,t,s)) ;
but GAMS show me this error:
Error 198: Set used in ‘ord’ or lag is not ordered
Please help me.
Thank you
Attachments
image.png

User avatar
bussieck
Moderator
Moderator
Posts: 479
Joined: 3 years ago

Re: define Sets in ALM problem

Post by bussieck » 3 months ago

You t set isn't order. Without seeing the entire GAMS model it is hard to suggest something. Ordering of sets can be subtle in GAMS. General advice: Declare and define the sets you need ordered first in your GAMS model.

-Michael

mr_khdm
User
User
Posts: 4
Joined: 7 months ago

Re: define Sets in ALM problem

Post by mr_khdm » 3 months ago

this is ALM problem Compact Model:

Image

and this is my code: (my code answer is invisible and this is my problem)

Code: Select all

$Title: Compact Model

sets
         i index of Property /1,2/
         n index of Node /0*14/
         s(n) /7*14/
         t(n) /1*6/                   ;

table a(n,s)
         7       8       9       10       11       12       13      14
0
1
2
3        1       1
4                        1       1
5                                         1        1
6                                                           1       1
7
8
9
10
11
12
13
14                                                                      ;

table b(n,t)
         1       2       3       4       5       6
0        1       1
1                        1       1
2                                        1       1
3
4
5
6
7
8
9
10
11
12
13
14                                                           ;


Scalars
         W0 /55000/
         L  /80000/
         q  /0.5/
         rr /0.2/    ;

parameters
         p(s) /7 0.125,8 0.125,9 0.125,10 0.125,11 0.125,12 0.125,13 0.125,14 0.125/
         R(i,n)    ;

table R(i,n)
         1       2       3       4       5       6       7       8       9       10      11      12      13      14
1        1.25    1.06    1.25    1.06    1.25    1.06    1.25    1.06    1.25    1.06    1.25    1.06    1.25    1.06
2        1.14    1.12    1.14    1.12    1.14    1.12    1.14    1.12    1.14    1.12    1.14    1.12    1.14    1.12   ;

variables
         Z ;

positive variables
         x(i,n)
         wn(s)
         wp(s)

Equations
         OF
         co1
         co2
         co3  ;

OF  .. z =e= sum(s,p(s)*(q*wp(s)-rr*wn(s)))     ;

co1      .. sum(i,x(i,'0')) =e= w0 ;
co2(t,n) .. sum(i,r(i,t) * x(i,n) * b(n,t)) =e= sum(i,x(i,t)) ;
co3(s,n) .. sum(i,r(i,n) * x(i,n) * a(n,s)) =e= l + wp(s) - wn(s)  ;

Model Objective1 /OF, co1, co2, co3/;
solve Objective1 using MIP max z ;

display z.l ,wp.l, wn.l, x.l ;


Now, Please help me.
thank you

Post Reply