# Question regarding stack\_solve\_algo

**URL:** https://forum.dynare.org/t/question-regarding-stack-solve-algo/22117
**Category:** Perfect foresight simulations
**Created:** [20 March 2023 12:36 UTC](https://forum.dynare.org/t/question-regarding-stack-solve-algo/22117 "2023-03-20T12:36:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tx1990](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@tx1990](https://forum.dynare.org/u/tx1990)
#### Post date: [20 March 2023 12:36 UTC](https://forum.dynare.org/t/question-regarding-stack-solve-algo/22117/1 "2023-03-20T12:36:19Z")

</div>

Dear all,

I have a question regarding the different solution algorithms used for perfect foresight simulations. I have a model, which I have written with an exogenous steady state file. The model’s perfect foresight solution can be found using the default algorithm as well as the option ‘stack\_solve\_algo=7’.  
[steady state file.zip](https://forum.dynare.org/uploads/short-url/ut7E4UmWzI2Lb6uw6LX4aUwEvmH.zip) (4.9 KB)

However, once I solve an equivalent model without the steady state file, but with an initval\_file, I find that the default algorithm is no longer able to find the solution. The option ‘stack\_solve\_algo=7’ does find the solution that is the same with the one solved with the external steady state file. I’m quite baffled by this and would like to ask what went wrong with my initval\_file, as I plan to extend on the current model and it seems weird that it’s not compatible with the default algorithm. My intuition is that the init\_val file does not solve the steady state, which model\_diagnostics report to be the case. Would that be the reason why the default algorithm is not working here?  
[initval file.zip](https://forum.dynare.org/uploads/short-url/cMR0oVRRUzUcbA0pX7OCz0neUTf.zip) (5.4 KB)

Best regard,  
Tian

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [22 March 2023 15:00 UTC](https://forum.dynare.org/t/question-regarding-stack-solve-algo/22117/2 "2023-03-22T15:00:29Z")

</div>

From what I can see, the two experiments are not the same. Inspecting `oo_.exo_simul` after `perfect_foresight_setup` shows for the `init_val_file`-version  
 ![image](https://forum.dynare.org/uploads/default/original/2X/0/06656bda480a169876feab8f12af1ce8cec06007.png)  
while for the other one  
 ![image](https://forum.dynare.org/uploads/default/original/2X/6/639ba475ece007a4638a6c6fb5d583fccd722da3.png)  
Thus, the shock sequence is different.

---

<div class="post-metadata">

### Author: ![tx1990](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@tx1990](https://forum.dynare.org/u/tx1990)
#### Post date: [23 March 2023 08:24 UTC](https://forum.dynare.org/t/question-regarding-stack-solve-algo/22117/3 "2023-03-23T08:24:53Z")

</div>

Thanks jpfeifer! I did not recognize the difference before. I’ll double check on my code.

Best,  
Tian
