## Lower Boundaries Error: MCP/PATH SOLVER

### Lower Boundaries Error: MCP/PATH SOLVER

Dear All,

I have been recently trying to disallow negative values of variables (say intermediate inputs used in activity, X(energyc,NE)) after the shock. This is because these negative values do not give any economic sense. To do so, I tried to implement Non Negative Variables for X(energyc,NE) or allowing lower boundaries (X.LO(energyc,NE)).

The detailed codes are as follows:

SET

A All Activities

/ element of all industries /

NE(A) Non-Energy Producing (NE-th industry)

/ sub-set of A for non-energy industries /

C All commodities

/ element of all commodities /

energyc(C) Energy commodity

/ sub-set of C for energy commodities /

Variables

X(C,A)

... and so on

Parameters

X0(C,A)

... and so on

EQUATIONS

eq18(energyc,NE)

eq18(energyc,NE) $(X0(energyc, NE)>0)..

(1+TAXFUEL(energyc, NE)) * P_Z(energyc) * (X(energyc, NE)**(1+teta(NE)))

- (kappa(energyc, NE) ** (1+teta(NE) ) ) * P_ENCOM(NE) * ENCOM(NE) /

( sum(energyca $(X0(energyca, NE)>0 and kappa(energyca, NE)>0),

(kappa(energyca, NE) ** (1+teta(NE) ) ) * (X(energyca, NE) **

(-teta(NE) ) ) ) ) =e= 0;

X.L(C,A)$(X0(C,A)>0) = X0(C,A) / SCAL_I ;

X.FX(C,A)$(X0(C,A)=0) = X0(C,A) / SCAL_I ;

X.LO(energyc, NE)$(X0(energyc, NE)>0) = 0;

When I run (execute) the code, it did not generate solution. Instead, I read an error message:

**** Unmatched variable not free or fixed

X(COAL_C,CHEMICAL_A)

**** Unmatched variable not free or fixed

X(COAL_C,FODT_A)

**** Unmatched variable not free or fixed

X(COAL_C,HTEL_A)

**** Unmatched variable not free or fixed

X(COAL_C,METAL_A)

... and so on

**** Counts do not match

Single equations in unmatched =E= blocks 2447

Unmatched single free variables 2342

I tried to learn how to solve this issue by reading the PATH manual book. I found that I need to use complementarity to get pairing of variables and equations. This is done by using, i.e. z.lo(i) = 0; or alternatively positive variable z;

And to write F(z) =g= 0.

I implemented this PATH manual precisely to the above code I had, where I changed the equality (=e=) to =g= in equation 18 and allowing X.LO(energyc, NE)$(X0(energyc, NE)>0) = 0. But, it gives the unmatched variable as shown above.

Could anyone help me on this matter? Your helps are really appreciated.

Cheers,

Herbert

--

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 https://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

### Re: Lower Boundaries Error: MCP/PATH SOLVER

Herbert,

The pairing of equations/variables is not accomplished by putting bounds on the variables or adjusting the =g=/=e= etc. used in the equations definition. The pairing is done in the model statement, e.g.

model m / F.z, g.x, myEquation.y /

This is a fundamental issue in complementarity models and is worth understanding thoroughly. It's part of the PATH documentation but I can't give a page reference: it comes up in so many places.

Also, if you're looking for a good example of a CGE model that uses complementarity, consider the IFPRI standard CGE model. They use explicit pairing of equations and variables quite effectively there.

http://www.ifpri.org/publication/standa ... del-gams-0

HTH,

-Steve

On Mon, Apr 4, 2016 at 9:04 AM, Herbert Loxa wrote:

Dear All,

I have been recently trying to disallow negative values of variables (say intermediate inputs used in activity, X(energyc,NE)) after the shock. This is because these negative values do not give any economic sense. To do so, I tried to implement Non Negative Variables for X(energyc,NE) or allowing lower boundaries (X.LO(energyc,NE)).

The detailed codes are as follows:

SET

A All Activities

/ element of all industries /

NE(A) Non-Energy Producing (NE-th industry)

/ sub-set of A for non-energy industries /

C All commodities

/ element of all commodities /

energyc(C) Energy commodity

/ sub-set of C for energy commodities /

Variables

X(C,A)

... and so on

Parameters

X0(C,A)

... and so on

EQUATIONS

eq18(energyc,NE)

eq18(energyc,NE) $(X0(energyc, NE)>0)..

(1+TAXFUEL(energyc, NE)) * P_Z(energyc) * (X(energyc, NE)**(1+teta(NE)))

- (kappa(energyc, NE) ** (1+teta(NE) ) ) * P_ENCOM(NE) * ENCOM(NE) /

( sum(energyca $(X0(energyca, NE)>0 and kappa(energyca, NE)>0),

(kappa(energyca, NE) ** (1+teta(NE) ) ) * (X(energyca, NE) **

(-teta(NE) ) ) ) ) =e= 0;

X.L(C,A)$(X0(C,A)>0) = X0(C,A) / SCAL_I ;

X.FX(C,A)$(X0(C,A)=0) = X0(C,A) / SCAL_I ;

X.LO(energyc, NE)$(X0(energyc, NE)>0) = 0;

When I run (execute) the code, it did not generate solution. Instead, I read an error message:

**** Unmatched variable not free or fixed

X(COAL_C,CHEMICAL_A)

**** Unmatched variable not free or fixed

X(COAL_C,FODT_A)

**** Unmatched variable not free or fixed

X(COAL_C,HTEL_A)

**** Unmatched variable not free or fixed

X(COAL_C,METAL_A)

... and so on

**** Counts do not match

Single equations in unmatched =E= blocks 2447

Unmatched single free variables 2342

I tried to learn how to solve this issue by reading the PATH manual book. I found that I need to use complementarity to get pairing of variables and equations. This is done by using, i.e. z.lo(i) = 0; or alternatively positive variable z;

And to write F(z) =g= 0.

I implemented this PATH manual precisely to the above code I had, where I changed the equality (=e=) to =g= in equation 18 and allowing X.LO(energyc, NE)$(X0(energyc, NE)>0) = 0. But, it gives the unmatched variable as shown above.

Could anyone help me on this matter? Your helps are really appreciated.

Cheers,

Herbert

--

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 https://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

The pairing of equations/variables is not accomplished by putting bounds on the variables or adjusting the =g=/=e= etc. used in the equations definition. The pairing is done in the model statement, e.g.

model m / F.z, g.x, myEquation.y /

This is a fundamental issue in complementarity models and is worth understanding thoroughly. It's part of the PATH documentation but I can't give a page reference: it comes up in so many places.

Also, if you're looking for a good example of a CGE model that uses complementarity, consider the IFPRI standard CGE model. They use explicit pairing of equations and variables quite effectively there.

http://www.ifpri.org/publication/standa ... del-gams-0

HTH,

-Steve

On Mon, Apr 4, 2016 at 9:04 AM, Herbert Loxa wrote:

Dear All,

I have been recently trying to disallow negative values of variables (say intermediate inputs used in activity, X(energyc,NE)) after the shock. This is because these negative values do not give any economic sense. To do so, I tried to implement Non Negative Variables for X(energyc,NE) or allowing lower boundaries (X.LO(energyc,NE)).

The detailed codes are as follows:

SET

A All Activities

/ element of all industries /

NE(A) Non-Energy Producing (NE-th industry)

/ sub-set of A for non-energy industries /

C All commodities

/ element of all commodities /

energyc(C) Energy commodity

/ sub-set of C for energy commodities /

Variables

X(C,A)

... and so on

Parameters

X0(C,A)

... and so on

EQUATIONS

eq18(energyc,NE)

eq18(energyc,NE) $(X0(energyc, NE)>0)..

(1+TAXFUEL(energyc, NE)) * P_Z(energyc) * (X(energyc, NE)**(1+teta(NE)))

- (kappa(energyc, NE) ** (1+teta(NE) ) ) * P_ENCOM(NE) * ENCOM(NE) /

( sum(energyca $(X0(energyca, NE)>0 and kappa(energyca, NE)>0),

(kappa(energyca, NE) ** (1+teta(NE) ) ) * (X(energyca, NE) **

(-teta(NE) ) ) ) ) =e= 0;

X.L(C,A)$(X0(C,A)>0) = X0(C,A) / SCAL_I ;

X.FX(C,A)$(X0(C,A)=0) = X0(C,A) / SCAL_I ;

X.LO(energyc, NE)$(X0(energyc, NE)>0) = 0;

When I run (execute) the code, it did not generate solution. Instead, I read an error message:

**** Unmatched variable not free or fixed

X(COAL_C,CHEMICAL_A)

**** Unmatched variable not free or fixed

X(COAL_C,FODT_A)

**** Unmatched variable not free or fixed

X(COAL_C,HTEL_A)

**** Unmatched variable not free or fixed

X(COAL_C,METAL_A)

... and so on

**** Counts do not match

Single equations in unmatched =E= blocks 2447

Unmatched single free variables 2342

I tried to learn how to solve this issue by reading the PATH manual book. I found that I need to use complementarity to get pairing of variables and equations. This is done by using, i.e. z.lo(i) = 0; or alternatively positive variable z;

And to write F(z) =g= 0.

I implemented this PATH manual precisely to the above code I had, where I changed the equality (=e=) to =g= in equation 18 and allowing X.LO(energyc, NE)$(X0(energyc, NE)>0) = 0. But, it gives the unmatched variable as shown above.

Could anyone help me on this matter? Your helps are really appreciated.

Cheers,

Herbert

--

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 https://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

### Re: Lower Boundaries Error: MCP/PATH SOLVER

Hi Steven,

Thanks very much for this. It helps me a lot. I just realized that I used: model /all/ in my code. So, that is the source of problems I had. Again, thank you so much.

Cheers,

Herbert

On Monday, April 4, 2016 at 3:23:33 PM UTC+1, Steven Dirkse wrote:

Herbert,

The pairing of equations/variables is not accomplished by putting bounds on the variables or adjusting the =g=/=e= etc. used in the equations definition. The pairing is done in the model statement, e.g.

model m / F.z, g.x, myEquation.y /

This is a fundamental issue in complementarity models and is worth understanding thoroughly. It's part of the PATH documentation but I can't give a page reference: it comes up in so many places.

Also, if you're looking for a good example of a CGE model that uses complementarity, consider the IFPRI standard CGE model. They use explicit pairing of equations and variables quite effectively there.

http://www.ifpri.org/publication/standa ... del-gams-0

HTH,

-Steve

On Mon, Apr 4, 2016 at 9:04 AM, Herbert Loxa wrote:

Dear All,

I have been recently trying to disallow negative values of variables (say intermediate inputs used in activity, X(energyc,NE)) after the shock. This is because these negative values do not give any economic sense. To do so, I tried to implement Non Negative Variables for X(energyc,NE) or allowing lower boundaries (X.LO(energyc,NE)).

The detailed codes are as follows:

SET

A All Activities

/ element of all industries /

NE(A) Non-Energy Producing (NE-th industry)

/ sub-set of A for non-energy industries /

C All commodities

/ element of all commodities /

energyc(C) Energy commodity

/ sub-set of C for energy commodities /

Variables

X(C,A)

... and so on

Parameters

X0(C,A)

... and so on

EQUATIONS

eq18(energyc,NE)

eq18(energyc,NE) $(X0(energyc, NE)>0)..

(1+TAXFUEL(energyc, NE)) * P_Z(energyc) * (X(energyc, NE)**(1+teta(NE)))

- (kappa(energyc, NE) ** (1+teta(NE) ) ) * P_ENCOM(NE) * ENCOM(NE) /

( sum(energyca $(X0(energyca, NE)>0 and kappa(energyca, NE)>0),

(kappa(energyca, NE) ** (1+teta(NE) ) ) * (X(energyca, NE) **

(-teta(NE) ) ) ) ) =e= 0;

X.L(C,A)$(X0(C,A)>0) = X0(C,A) / SCAL_I ;

X.FX(C,A)$(X0(C,A)=0) = X0(C,A) / SCAL_I ;

X.LO(energyc, NE)$(X0(energyc, NE)>0) = 0;

When I run (execute) the code, it did not generate solution. Instead, I read an error message:

**** Unmatched variable not free or fixed

X(COAL_C,CHEMICAL_A)

**** Unmatched variable not free or fixed

X(COAL_C,FODT_A)

**** Unmatched variable not free or fixed

X(COAL_C,HTEL_A)

**** Unmatched variable not free or fixed

X(COAL_C,METAL_A)

... and so on

**** Counts do not match

Single equations in unmatched =E= blocks 2447

Unmatched single free variables 2342

I tried to learn how to solve this issue by reading the PATH manual book. I found that I need to use complementarity to get pairing of variables and equations. This is done by using, i.e. z.lo(i) = 0; or alternatively positive variable z;

And to write F(z) =g= 0.

I implemented this PATH manual precisely to the above code I had, where I changed the equality (=e=) to =g= in equation 18 and allowing X.LO(energyc, NE)$(X0(energyc, NE)>0) = 0. But, it gives the unmatched variable as shown above.

Could anyone help me on this matter? Your helps are really appreciated.

Cheers,

Herbert

--

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.

To post to this group, send email to gams...@googlegroups.com.

Visit this group at https://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

sdi...@gams.com

http://www.gams.com

--

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 https://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.