Help with error $ 125

I am trying to make a subset and find out the sum of elements in the
subset. However, I am getting error $125 pl help if you can. my code
as below-:

Set
I ‘number of products’ / 1*3 /
F(I) ‘products of firm 2’ /2, 3/;

alias (I,J);

Table Data(I, *) ‘Marginal cost Data’
C
1 2
2 2
3 2 ;

Parameter C(I) ‘Marginal Cost of each firms’ ;

C(I)= Data(I,‘C’);

Positive variables q(I) ‘production vector’
M(F) ‘production vector for firm 2’ ;

Variables P ‘price’ ;

Equations
dNegprofit(I) ‘differentiation of negative profit, d(-profit)/
dq: dTC - p - q(I)*dp’
Defp ‘Demand function’
TQ(I) ‘total quantity for firm 2’;

dnegprofit(I)…
C(I) - P + q(I) =g= 0 ;

Defp…P =e= 10-Sum(J, q(J));

TQ(F)… M(F) =e= Sum(F, q(F)); (The error results in this statement)

Model Cournot /dnegprofit.q, defp.p, TQ/;

Solve cournot using mcp ;

–~–~---------~–~----~------------~-------~–~----~
To post to this group, send email to gamsworld@googlegroups.com
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en
-~----------~----~----~----~------~----~------~–~—

\

Hi

You are trying to sum over F, but F (as Gams told) you is already under
control, meaning in this case:

  • that you defined this equation over F (so there is an equation for every
    element of F)
  • and you sum for every equation on the right hand side over all F.
    This is probably not what you want.



    You are probably looking for an equation for firm 2 that gives you the
    quantity of different products.

Positive variables q(I) ‘production vector’
M ‘production vector for firm 2’ ;

Variables P ‘price’ ;

Equations
dNegprofit(I)
Defp ‘Demand function’
TQ ‘total quantity for firm 2’;

dnegprofit(I)…
C(I) - P + q(I) =g= 0 ;

Defp…P =e= 10-Sum(J, q(J));

TQ… M =e= Sum(F, q(F));

Model Cournot /dnegprofit.q, defp.p, TQ.M/;

Solve cournot using mcp ;


Renger


-----Original Message-----
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On
Behalf Of ashu
Sent: Thursday, June 18, 2009 11:00 PM
To: gamsworld
Subject: Help with error $ 125


I am trying to make a subset and find out the sum of elements in the subset.
However, I am getting error $125 pl help if you can. my code as below-:

Set
I ‘number of products’ / 1*3 /
F(I) ‘products of firm 2’ /2, 3/;

alias (I,J);

Table Data(I, *) ‘Marginal cost Data’
C
1 2
2 2
3 2 ;

Parameter C(I) ‘Marginal Cost of each firms’ ;

C(I)= Data(I,‘C’);

Positive variables q(I) ‘production vector’
M(F) ‘production vector for firm 2’ ;

Variables P ‘price’ ;

Equations
dNegprofit(I) ‘differentiation of negative profit, d(-profit)/
dq: dTC - p - q(I)*dp’
Defp ‘Demand function’
TQ(I) ‘total quantity for firm 2’;

dnegprofit(I)…
C(I) - P + q(I) =g= 0 ;

Defp…P =e= 10-Sum(J, q(J));

TQ(F)… M(F) =e= Sum(F, q(F)); (The error results in this statement)

Model Cournot /dnegprofit.q, defp.p, TQ/;

Solve cournot using mcp ;



–~–~---------~–~----~------------~-------~–~----~
To post to this group, send email to gamsworld@googlegroups.com
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en
-~----------~----~----~----~------~----~------~–~—

\

Thanks a lot Renger, I was able to solve it on your advice.

On Jun 19, 1:06 am, Renger van Nieuwkoop
wrote:

Hi

You are trying to sum over F, but F (as Gams told) you is already under
control, meaning in this case:

  • that you defined this equation over F (so there is an equation for every
    element of F)
  • and you sum for every equation on the right hand side over all F.
    This is probably not what you want.

You are probably looking for an equation for firm 2 that gives you the
quantity of different products.

Positive variables q(I) ‘production vector’
M ‘production vector for firm 2’ ;

Variables P ‘price’ ;

Equations
dNegprofit(I)
Defp ‘Demand function’
TQ ‘total quantity for firm 2’;

dnegprofit(I)…
C(I) - P + q(I) =g= 0 ;

Defp…P =e= 10-Sum(J, q(J));

TQ… M =e= Sum(F, q(F));

Model Cournot /dnegprofit.q, defp.p, TQ.M/;

Solve cournot using mcp ;

Renger

-----Original Message-----
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On

Behalf Of ashu
Sent: Thursday, June 18, 2009 11:00 PM
To: gamsworld
Subject: Help with error $ 125

I am trying to make a subset and find out the sum of elements in the subset.
However, I am getting error $125 pl help if you can. my code as below-:

Set
I ‘number of products’ / 1*3 /
F(I) ‘products of firm 2’ /2, 3/;

alias (I,J);

Table Data(I, *) ‘Marginal cost Data’
C
1 2
2 2
3 2 ;

Parameter C(I) ‘Marginal Cost of each firms’ ;

C(I)= Data(I,‘C’);

Positive variables q(I) ‘production vector’
M(F) ‘production vector for firm 2’ ;

Variables P ‘price’ ;

Equations
dNegprofit(I) ‘differentiation of negative profit, d(-profit)/
dq: dTC - p - q(I)*dp’
Defp ‘Demand function’
TQ(I) ‘total quantity for firm 2’;

dnegprofit(I)…
C(I) - P + q(I) =g= 0 ;

Defp…P =e= 10-Sum(J, q(J));

TQ(F)… M(F) =e= Sum(F, q(F)); (The error results in this statement)

Model Cournot /dnegprofit.q, defp.p, TQ/;

Solve cournot using mcp ;
–~–~---------~–~----~------------~-------~–~----~
To post to this group, send email to gamsworld@googlegroups.com
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en
-~----------~----~----~----~------~----~------~–~—

\