adding more constraint to gams

Problems with modeling
Post Reply
abrahamjp
User
User
Posts: 3
Joined: 2 years ago

adding more constraint to gams

Post by abrahamjp » 3 months ago

Hi,

I look into adding some additional bounds/constraints to following MODEL (program is part of simple moral hazard situation :idea:3 equations,3 variables-
(i)U
(ii &iii) w(x) is variable while argument x takes 2 values-High Investment,Low investment) ;
r(x) has fixed value)

Code: Select all

[code]obj..           U =e= sum((x,y), dummy(y)*p(x,y)*(r(x) - w(x)));
pc(y)..         (sum(x,p(x,y)*sqrt(w(x)))-d(y))*dummy(y) =g= 0;
ic(v,y)..       ((sum(x,p(x,v)*sqrt(w(x)))-d(v))
                -(sum(x,p(x,y)*sqrt(w(x)))-d(y)))*dummy(v) =g= 0;
[/code]


r(x) & w(x) are related as below;
1.3w(x) < r(x) < 1.6 w(x)
How I can put this in my program.

I can send full program if required.


THANX IN ADVANCE (please neglect any numerical twists due to present fixed numbers-I am looking for how to capture bound/constraint into Model where argument is a set)

ABRAHAM

User avatar
Renger
Posts: 545
Joined: 3 years ago

Re: adding more constraint to gams

Post by Renger » 3 months ago

Hi
You could just split the constraint in:

Code: Select all

upperb(x)..  1.3 * w(x)  =L=r(x); 
lowerb(x)..   r(x) =L= 1.6 * w(x);
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

abrahamjp
User
User
Posts: 3
Joined: 2 years ago

Re: adding more constraint to gams

Post by abrahamjp » 3 months ago

Dear Renger,
My great thanks for that –It worked;

Code: Select all

obj..   	U =e= sum((x,y), dummy(y)*p(x,y)*(r(x) - w(x)));
pc(y)..	 	(sum(x,p(x,y)*sqrt(w(x)))-d(y))*dummy(y) =g= 0;
ic(v,y)..	((sum(x,p(x,v)*sqrt(w(x)))-d(v))
	        -(sum(x,p(x,y)*sqrt(w(x)))-d(y)))*dummy(v) =g= 0;
	        
upperb(x).. 1.2*w(x) =l= r(x);
lowerb(x)..r(x) =l= 1.6*w(x);
For my program,I need to extend it to be 2-dimensions[(w(x,y),d(x,y) instead of 1-dimension[w(x),d(x)] as follows;(so variables earlier decalred as parameter-now in table)

Code: Select all

obj..   	U =e= sum((x,y), (dummy(y)*p(x,y)*(r(x,y) - w(x,y))));
pc(y)..	 	(sum(x,p(x,y)*(sqrt(w(x,y))-d(x,y))))*dummy(y) =g= 0;
ic(v,y)..	((sum(x,p(x,v)*(sqrt(w(x,v))-d(x,v))))
	        -(sum(x,p(x,y)*(sqrt(w(x,v))-d(x,y)))))*dummy(v) =g= 0;
	        
upperb(x,y).. 1.2*w(x,y) =l= r(x,y);
lowerb(x,y)..r(x,y) =l= 1.6*w(x,y);
I checked it in GAMS by putting same values in tables (means like

Code: Select all

Table r(x,y)    agent's cost
        low     high
failure 13       13
success 45       45
;
And checked output-it is same as before and it means it is correct-I need to change to different values later.
Do you see any logical incorrectness in this approach.
Best regards
Abraham

User avatar
Renger
Posts: 545
Joined: 3 years ago

Re: adding more constraint to gams

Post by Renger » 3 months ago

looks fine.
R
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

Post Reply