Page 1 of 1

MCP solver Infeasible

Posted: Sun Feb 16, 2020 6:07 am
by frds17
Upload.gms
(1.6 KiB) Downloaded 555 times
Dear All,

I am trying to solve the following equations using MCP.

Code: Select all

equations
production(t).. Y(t)=e=(kappa*[epsilon*K(t)**(1-1/sigma)+(1-epsilon)*L(t)**(1-1/sigma)]**[1/(1-1/sigma)])-(0.5*psi*(I(t)/K(t) -[n+g+n*g+delta])**(2) *K(t));

wage(t).. w(t)=e=((1-epsilon)*kappa*L(t)**(-1/sigma)*(epsilon*K(t)**(1-1/sigma)+(1-epsilon)*L(t)**(1-1/sigma))**(-1+(1/(1-1/sigma))))/(1+nu);

capital_cost_acc(t).. q(t+1)=e=1+(1-tau_f)*(psi*(I(t)/K(t)-[n+g+n*g+delta]));

capital_cost(t).. r*q(t)=e=(1-tau_f)*[(epsilon*K(t)**(-1/sigma)*kappa*(epsilon*K(t)**(1-1/sigma)+(1-epsilon)*L(t)**(1-1/sigma))**(-1+(1/(1-1/sigma))))-(0.5*psi*(I(t)/K(t) -[n+g+n*g+delta])**(2) *K(t) - psi*I(t)*(I(t)/K(t) -[n+g+n*g+delta])/K(t))+(1-delta)*(q(t)-q(t-1))-delta*q(t)];

capital_accumulation(t).. K(t+1)=e=[(1-delta)*K(t)+I(t)]/((1+n)*(1+g));

Investment(t).. I(t)=e=(n+g+n*g+delta)*K(t);

model pro /production.Y wage.w capital_cost_acc.L capital_cost.q capital_accumulation.K Investment.I/;
option mcp=path;
solve pro using mcp;
In the output it is infeasible due to "Force Row Upper Infinite Value" capital_accumulation
If I change capital_accumulation to K(t)=e=....K(t-1)+I(t). I get infeasible due to capital_cost_acc "Force Row Zero Infeasible.

Thanks for any help you may offer.

Re: MCP solver Infeasible

Posted: Sun Feb 16, 2020 10:42 am
by Renger
Hi

I only noticed the following: If you look at the two equations capital_cost and capital_cost_acc, you in fact have two equations for the same variable Q and both are for period 2. In the capital_cost you use Q(t-1) but it is nowhere defined if t =1 (you need something like Q("0") which is not part of the model, so this equation only can be used for t>1.
For debugging, I strongly suggest to derive some sensible starting values for the variables by using your assumptions and, for example, fixing the labor endowment by L0 * (1 + n)**t.val as well as setting a start value for the capital. This will then show if your equations are right and if you can calculate all the variables.
Cheers
Renger

Re: MCP solver Infeasible

Posted: Sun Feb 16, 2020 11:14 pm
by frds17
Hi

Thank you for your reply. I changed K(t+1) to K(t) in the capital_accumulaiton(t) equation and fixed L(t), and it is able to find a solution.

I have another model that when solved will need to update the value of L(t). How am I able to define this in a loop?

Thanks
Fabio

Re: MCP solver Infeasible

Posted: Mon Feb 17, 2020 8:06 am
by Renger
Hi

You mean that L(t) is exogenous in every period like L(t) = (1+n)**t.val * L0?
Cheers
Renger

Re: MCP solver Infeasible

Posted: Mon Feb 17, 2020 8:37 am
by frds17
Hi,

L(t) is exogeneous in the sense that L.fx(this model)=L.l (from another model).

Thanks,
Fabio

Re: MCP solver Infeasible

Posted: Mon Feb 17, 2020 8:51 am
by gamsadmin
Then you run the model that solves for L and then you just write for the second model

L.FX(t) = L.L(t);

(you might want to use a result parameter to do this

resultsL(t) = L.L(t);
L.FX(t) = resultsL(t);

Be aware that a variable is fixed for all model solves after the fixture. If you want to "unfix" the variable, you have to explicitly set the lower and upper bound to minus and plus inifinity.

Cheers
Renger

Re: MCP solver Infeasible

Posted: Mon Feb 17, 2020 8:56 am
by frds17
Thank you, that is exactly what I wanted to do.
Fabio