Problem with constraint in MCP

Problems with modeling
Post Reply
gamsnoob123
User
User
Posts: 2
Joined: 4 years ago

Problem with constraint in MCP

Post by gamsnoob123 »

Dear gams-forum-members,

I have a problem modelling a simple MCP problem in GAMS. I want to use KKT-Conditions to solve this problem.

I attached a picture of the code.

The problem is that GAMS solves for Q(i) the value -2,5. I don't understand this because in the equation "ConstQmy2(i)" I state that Q(i) =g= 0.

I hope somebody can help me here.

Thanks in advance,
gamsnoob123
gms_file.jpeg
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Problem with constraint in MCP

Post by Renger »

Hi
It would be easier if you would paste your code in your post (use the button </> so it is formatted correctly).
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
gamsnoob123
User
User
Posts: 2
Joined: 4 years ago

Re: Problem with constraint in MCP

Post by gamsnoob123 »

Code: Select all

Sets i /1*2/;
Alias(i,ii);

Parameters c(i), x(i), v(i), tau;

c(i) = 3;
x(i) = 1;
v("1") = 12;
v("2") = 12;
tau=4;

Variables lambda(i), Q(i), p(i);
Positive Variables my1(i), my2(i);

Equations KKTQ(i), KKTp(i), ConstQ(i), ConstQmy1(i), ConstQmy2(i);

KKTp(i) .. Q(i) =e= - lambda(i)/(2*tau);

KKTQ(i) .. p(i)-c(i) =e= lambda(i)+my1(i)-my2(i);

ConstQ(i) .. Q(i) =e= 0.5 + 1/(2*tau)*(v(i)-sum(ii$(ii.val<>i.val), v(i))-(p(i)-sum(ii$(ii.val<>i.val),p(i))));

ConstQmy1(i) .. x(i) - Q(i) =g= 0;
ConstQmy2(i) .. Q(i) =g= 0;

Model MCPModel /KKTp.p, KKTQ.Q, ConstQ.lambda, ConstQmy1.my1, ConstQmy2.my2/;
Solve MCPModel using MCP;

Parameters demand(ii), marketshare(ii), price(ii);

demand(ii)=Q.l(ii);
marketshare(ii) = Q.l(ii)/sum(i, Q.l(ii));
price(ii) = p.l(ii);
display demand, marketshare, price;
User avatar
dirkse
Moderator
Moderator
Posts: 214
Joined: 7 years ago
Location: Fairfax, VA

Re: Problem with constraint in MCP

Post by dirkse »

Hi,

I got the same results you did, and they didn't make sense to me either. I ran PATH without the preprocessor and then PATH returned a different (and consistent) solution.

You can do the same thing by creating an option file path.opt with this line:
preprocess 0

and tell PATH to use this option file, e.g. by including

MCPModel.optfile = 1;

in your GAMS code.

I will post later with more information about this PATH bug, after I do some investigating.

-Steve
User avatar
dirkse
Moderator
Moderator
Posts: 214
Joined: 7 years ago
Location: Fairfax, VA

Re: Problem with constraint in MCP

Post by dirkse »

Hello,

Just following up on this issue. The problem has been analyzed and fixed by the PATH team (thanks Todd!). The fix will be available with PATH 5.0.2 released with the next GAMS distribution. Until that is released, please run this model with preprocessing turned off, as described earlier in this thread.

Thanks for mentioning this issue and sorry for the inconvenience this bug causes.

-Steve
Post Reply