Commit f59bba3d authored by ferhat's avatar ferhat
Browse files

- Adding SOLVE_FORWARD_COMPLETE and SOLVE_BACKWARD_COMPLETE simulation type for sparse model option

- Adding dyn2vec at the end of a deterministic simulation with sparse or sparse_dll option

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2178 ac1d8469-bf42-47a9-8791-bf33cf982152
parent d46c423c
No preview for this file type
......@@ -72,29 +72,29 @@ function model_info;
function ret=Sym_type(type);
EVALUATE_FOREWARD=0;
EVALUATE_FORWARD=0;
EVALUATE_BACKWARD=1;
SOLVE_FOREWARD_SIMPLE=2;
SOLVE_FORWARD_SIMPLE=2;
SOLVE_BACKWARD_SIMPLE=3;
SOLVE_TWO_BOUNDARIES_SIMPLE=4;
SOLVE_FOREWARD_COMPLETE=5;
SOLVE_FORWARD_COMPLETE=5;
SOLVE_BACKWARD_COMPLETE=6;
SOLVE_TWO_BOUNDARIES_COMPLETE=7;
EVALUATE_FOREWARD_R=8;
EVALUATE_FORWARD_R=8;
EVALUATE_BACKWARD_R=9;
switch (type)
case {EVALUATE_FOREWARD,EVALUATE_FOREWARD_R},
ret='EVALUATE FOREWARD ';
case {EVALUATE_FORWARD,EVALUATE_FORWARD_R},
ret='EVALUATE FORWARD ';
case {EVALUATE_BACKWARD,EVALUATE_BACKWARD_R},
ret='EVALUATE BACKWARD ';
case SOLVE_FOREWARD_SIMPLE,
ret='SOLVE FOREWARD SIMPLE ';
case SOLVE_FORWARD_SIMPLE,
ret='SOLVE FORWARD SIMPLE ';
case SOLVE_BACKWARD_SIMPLE,
ret='SOLVE BACKWARD SIMPLE ';
case SOLVE_TWO_BOUNDARIES_SIMPLE,
ret='SOLVE TWO BOUNDARIES SIMPLE ';
case SOLVE_FOREWARD_COMPLETE,
ret='SOLVE FOREWARD COMPLETE ';
case SOLVE_FORWARD_COMPLETE,
ret='SOLVE FORWARD COMPLETE ';
case SOLVE_BACKWARD_COMPLETE,
ret='SOLVE BACKWARD COMPLETE ';
case SOLVE_TWO_BOUNDARIES_COMPLETE,
......
......@@ -381,7 +381,7 @@ BlockTriangular::Allocate_Block(int size, int *count_Equ, int *count_Block, Bloc
else if((Lead > 0) && (Lag == 0))
ModelBlock->Block_List[*count_Block].Simulation_Type = SOLVE_BACKWARD_SIMPLE;
else
ModelBlock->Block_List[*count_Block].Simulation_Type = SOLVE_FOREWARD_SIMPLE;
ModelBlock->Block_List[*count_Block].Simulation_Type = SOLVE_FORWARD_SIMPLE;
ModelBlock->Block_List[*count_Block].IM_lead_lag = (IM_compact*)malloc((Lead + Lag + 1) * sizeof(IM_compact));
ModelBlock->Block_List[*count_Block].Nb_Lead_Lag_Endo = nb_lead_lag_endo;
if(nb_lead_lag_endo)
......@@ -528,14 +528,14 @@ BlockTriangular::Allocate_Block(int size, int *count_Equ, int *count_Block, Bloc
if(Lead > 0)
ModelBlock->Block_List[*count_Block].Simulation_Type = SOLVE_BACKWARD_COMPLETE;
else
ModelBlock->Block_List[*count_Block].Simulation_Type = SOLVE_FOREWARD_COMPLETE;
ModelBlock->Block_List[*count_Block].Simulation_Type = SOLVE_FORWARD_COMPLETE;
}
else
{
if(Lead > 0)
ModelBlock->Block_List[*count_Block].Simulation_Type = SOLVE_BACKWARD_SIMPLE;
else
ModelBlock->Block_List[*count_Block].Simulation_Type = SOLVE_FOREWARD_SIMPLE;
ModelBlock->Block_List[*count_Block].Simulation_Type = SOLVE_FORWARD_SIMPLE;
}
ModelBlock->Block_List[*count_Block].Max_Lag = Lag;
ModelBlock->Block_List[*count_Block].Max_Lead = Lead;
......
......@@ -135,6 +135,7 @@ SimulSparseStatement::writeOutput(ostream &output, const string &basename) const
//output << "oo_.endo_simul=" << basename << "_dynamic();\n";
output << basename << "_dynamic;\n";
}
output << "dyn2vec;\n";
}
StochSimulStatement::StochSimulStatement(const SymbolList &symbol_list_arg,
......
This diff is collapsed.
......@@ -96,16 +96,16 @@ public:
{
switch (type)
{
case EVALUATE_FOREWARD:
case EVALUATE_FOREWARD_R:
return ("EVALUATE FOREWARD ");
case EVALUATE_FORWARD:
case EVALUATE_FORWARD_R:
return ("EVALUATE FORWARD ");
break;
case EVALUATE_BACKWARD:
case EVALUATE_BACKWARD_R:
return ("EVALUATE BACKWARD ");
break;
case SOLVE_FOREWARD_SIMPLE:
return ("SOLVE FOREWARD SIMPLE ");
case SOLVE_FORWARD_SIMPLE:
return ("SOLVE FORWARD SIMPLE ");
break;
case SOLVE_BACKWARD_SIMPLE:
return ("SOLVE BACKWARD SIMPLE ");
......@@ -113,8 +113,8 @@ public:
case SOLVE_TWO_BOUNDARIES_SIMPLE:
return ("SOLVE TWO BOUNDARIES SIMPLE ");
break;
case SOLVE_FOREWARD_COMPLETE:
return ("SOLVE FOREWARD COMPLETE ");
case SOLVE_FORWARD_COMPLETE:
return ("SOLVE FORWARD COMPLETE ");
break;
case SOLVE_BACKWARD_COMPLETE:
return ("SOLVE BACKWARD COMPLETE ");
......
......@@ -52,15 +52,15 @@ enum BlockType
enum BlockSimulationType
{
UNKNOWN = -1, //!< Unknown simulation type
EVALUATE_FOREWARD = 0, //!< Simple evaluation, normalized variable on left-hand side, forward
EVALUATE_FORWARD = 0, //!< Simple evaluation, normalized variable on left-hand side, forward
EVALUATE_BACKWARD = 1, //!< Simple evaluation, normalized variable on left-hand side, backward
SOLVE_FOREWARD_SIMPLE = 2, //!< Block of one equation, newton solver needed, forward
SOLVE_FORWARD_SIMPLE = 2, //!< Block of one equation, newton solver needed, forward
SOLVE_BACKWARD_SIMPLE = 3, //!< Block of one equation, newton solver needed, backward
SOLVE_TWO_BOUNDARIES_SIMPLE = 4, //!< Block of one equation, newton solver needed, forward & ackward
SOLVE_FOREWARD_COMPLETE = 5, //!< Block of several equations, newton solver needed, forward
SOLVE_FORWARD_COMPLETE = 5, //!< Block of several equations, newton solver needed, forward
SOLVE_BACKWARD_COMPLETE = 6, //!< Block of several equations, newton solver needed, backward
SOLVE_TWO_BOUNDARIES_COMPLETE = 7, //!< Block of several equations, newton solver needed, forward and backwar
EVALUATE_FOREWARD_R = 8, //!< Simple evaluation, normalized variable on right-hand side, forward
EVALUATE_FORWARD_R = 8, //!< Simple evaluation, normalized variable on right-hand side, forward
EVALUATE_BACKWARD_R = 9 //!< Simple evaluation, normalized variable on right-hand side, backward
};
......
var c i g infl y k l r p1 q1 p2 q2 r0;
varexo g_bar;
parameters a b d e f h j m n o p q;
a=0.4*0.6;
b=0.3*0.6;
d=0.1;
e=0.15;
f=1;
h=0.15;
j=1;
m=1;
n=1;
o=1;
model(SPARSE_DLL,cutoff=1e-12);
/*0*/ k=(1-h)*k(-1)+i; /*k:0*/
/*1*/ y=l^j*k^m; /*l:1*/
/*2*/ c=y*a+b+0.3*c(-1)+0.1*c(+1)+0.*g_bar(-10); /*c:2*/
/*3*/ infl=0.02*y+0.5*r; /*infl:3*/
/*4*/ i=d*(y-y(-1))+e/**r*/; /*i4*/
/*5*/ g=f*g_bar; /*g:5*/
/*6*/ y=0.6*(c+i+g)+/*0.1*y(-2)+0.1*y(+2)+*/0.1*y(-1)+0.1*y(+1); /*y:6*/
/*7*/ r=y-1+infl-0.02; /*r7*/
/*8*/ p1=i+0.5*q1;
/*9*/ q1=0.5*p1+c;
/*10*/ q2=0.5*p2+r0;
/*11*/ p2=0.5*q2+p1;
/*12*/ r0=r;
end;
initval;
//g_bar=0.15*(3.0+1==2.0);
g_bar=max(2*(h==0.15),3*(d>0.2));
c=0.7;
i=0.15;
g=0.15;
y=1;
k=0.2;
l=1;
infl=0.02;
r=0;
r0=r;
p1=2/3;
q1=3.1/3;
q2=4/9;
p2=8/9;
end;
steady(solve_algo=2);
//check;
shocks;
var g_bar;
periods 1;
values 0.16;
end;
options_.slowc = 1;
simul(periods=80);
rplot c;
rplot y;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment