Help with a simple Cournot problem (MCP)

Hi there,

I would like to solve a (trivial) environmental problem related to a global pollutant. The problem is basically a Cournot game where countries have to choose the optimal level of emissions given a quadratic emission benefit function and a quadratic emission damage (cost) function. So, welfare for country i is given by W(i) = b*(ae(i)-1/2e(i)^2) - 1/2cE^2, where E = sum over i of e(i). Of course, the problem can be easily solved analytically, but I would like to find the solution using the MCP solver.

I tried this code:

Set
i /1*10/
alias(j,i);
Scalars
a /10/
b /6/
c /0.39999/
d /0.239994/
Positive Variables
e(i) emission level of country i

Equations

Ineq(i) non-negative emissions
foc(i) first order condition
zeroc(i) slackness condition;

zeroc(i)… (ba-be(i)-c*(sum(j,e(j))))e(i) =e= 0; * slackness condition
Ineq(i)… e(i) =g= 0;
foc(i)… -b
a+be(i)+c(sum(j,e(j))) =g= 0; * FOC


model sartmcp / zeroc, ineq.e, foc.e/;
solve sartmcp using MCP;

Anyway, it is wrong. I get exit code 3. Is there anyone so kind to help me solving it.

Thanks a lot,

Marco

P.S. As you can easily understand, I am a very beginner of GAMS.







\

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/d/optout.

Marco,

Given that you’re just starting out in GAMS, I’d say step 0 would be to formulate the optimization problem for a single-country model. Next you can move on to reproducing the step 0 solution (still for a single-country model) via the KKT conditions solved as MCP.

A few things jump out at me from your post. You match the variable e to both ineq and foc, which won’t work. Nothing is matched to zeroc: if you are having trouble, my first rule is to match everything explicitly. It’s not necessary, but it helps expose problems in programming or conceptual structure. Variable e is declared positive, so the equation ineq(i) should not be used.

As an exercise, maybe you should start with a simpler objective: min sum{i, sqr(x_i - c_i)} s.t. x >=0. When you’ve got that nailed down the move to your problem is just a matter of a more complicated functional form, correct?

-Steve

On Thu, Mar 12, 2015 at 12:57 PM, Marco R. wrote:

Hi there,

I would like to solve a (trivial) environmental problem related to a global pollutant. Basically, countries have to choose their optimal level of emissions facing a quadratic benefit function b*(ae(i)-1/2e(i)^2) and a quadratic damage (cost) function 1/2cE^2, where E = sum over i of e(i). Obviously e(i) is the level of emissions, a,b and c are parameters and the damage faced by a country is given by the sum of the emissions emitted by all countries (so E). The welfare function for country i is then

W(i) = b*(ae(i)-1/2e(i)^2) - 1/2cE^2.

The model can be easily solved analytically, but I would like to solve it in GAMS and I think the proper way of doing it should be to use the MCP solver.

The (wrong) code that I have written is the following:

Set
i /1*10/
alias(j,i);

Scalars
a /10/
b /6/
c /0.39999/

Positive Variables
e(i) emission level of country i


Equations
Ineq(i) non-negative emissions
foc(i) first order condition FOC
zeroc(i) slackness condition;

zeroc(i)… (ba-be(i)-c*(sum(j,e(j))))e(i) =e= 0;
Ineq(i)… e(i) =g= 0;
foc(i)… -b
a+be(i)+c(sum(j,e(j))) =g= 0;

model sartmcp / zeroc, ineq.e, foc.e/;
solve sartmcp using MCP;
display e.l;

Unfortunately, it does not work. I get exit code 3. Is there someone that can help me to write it in the correct way.

Thanks a lot,

Marco

P.S. As you can easily understand I am a very beginner GAMS user.



\

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/d/optout.



\

Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdirkse@gams.com
http://www.gams.com

Thanks a lot Steven,

anyway I think I have solved the exercise you have suggested. That one, in fact, replicate countries acting as a coalition. Instead of compiting among them in a “emission game”, they act as a group maximizing the group welfare (or minimizing the cost). This can be solved with NLP. My problem is to get the solution for the non-cooperative case, but setting the MCP is more complicated…

Well, maybe is just a matter of time and practice.

Thanks again,

Marco

Il giorno giovedì 12 marzo 2015 19:10:37 UTC+1, Marco R. ha scritto:

Hi there,

I would like to solve a (trivial) environmental problem related to a global pollutant. The problem is basically a Cournot game where countries have to choose the optimal level of emissions given a quadratic emission benefit function and a quadratic emission damage (cost) function. So, welfare for country i is given by W(i) = b*(ae(i)-1/2e(i)^2) - 1/2cE^2, where E = sum over i of e(i). Of course, the problem can be easily solved analytically, but I would like to find the solution using the MCP solver.

I tried this code:

Set
i /1*10/
alias(j,i);
Scalars
a /10/
b /6/
c /0.39999/
d /0.239994/
Positive Variables
e(i) emission level of country i

Equations

Ineq(i) non-negative emissions
foc(i) first order condition
zeroc(i) slackness condition;

zeroc(i)… (ba-be(i)-c*(sum(j,e(j))))e(i) =e= 0; * slackness condition
Ineq(i)… e(i) =g= 0;
foc(i)… -b
a+be(i)+c(sum(j,e(j))) =g= 0; * FOC


model sartmcp / zeroc, ineq.e, foc.e/;
solve sartmcp using MCP;

Anyway, it is wrong. I get exit code 3. Is there anyone so kind to help me solving it.

Thanks a lot,

Marco

P.S. As you can easily understand, I am a very beginner of GAMS.







\

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/d/optout.

Hey Steven,

I finally managed to get a result!!! Just leaving the foc equation, associated to e, and setting the lower bound of e(i) to 0, it works. No need for the zeroc and Ineq equations.

Many thanks,

MR

Il giorno giovedì 12 marzo 2015 19:10:37 UTC+1, Marco R. ha scritto:

Hi there,

I would like to solve a (trivial) environmental problem related to a global pollutant. The problem is basically a Cournot game where countries have to choose the optimal level of emissions given a quadratic emission benefit function and a quadratic emission damage (cost) function. So, welfare for country i is given by W(i) = b*(ae(i)-1/2e(i)^2) - 1/2cE^2, where E = sum over i of e(i). Of course, the problem can be easily solved analytically, but I would like to find the solution using the MCP solver.

I tried this code:

Set
i /1*10/
alias(j,i);
Scalars
a /10/
b /6/
c /0.39999/
d /0.239994/
Positive Variables
e(i) emission level of country i

Equations

Ineq(i) non-negative emissions
foc(i) first order condition
zeroc(i) slackness condition;

zeroc(i)… (ba-be(i)-c*(sum(j,e(j))))e(i) =e= 0; * slackness condition
Ineq(i)… e(i) =g= 0;
foc(i)… -b
a+be(i)+c(sum(j,e(j))) =g= 0; * FOC


model sartmcp / zeroc, ineq.e, foc.e/;
solve sartmcp using MCP;

Anyway, it is wrong. I get exit code 3. Is there anyone so kind to help me solving it.

Thanks a lot,

Marco

P.S. As you can easily understand, I am a very beginner of GAMS.







\

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/d/optout.