# Minimizing negative welfare

**URL:** https://forum.dynare.org/t/minimizing-negative-welfare/3416
**Category:** Dynare help (legacy posts)
**Created:** [30 September 2013 16:41 UTC](https://forum.dynare.org/t/minimizing-negative-welfare/3416 "2013-09-30T16:41:54Z")
**Posts on this page:** 1
**Showing post:** 4

<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: [30 September 2013 19:27 UTC](https://forum.dynare.org/t/minimizing-negative-welfare/3416/4 "2013-09-30T19:27:28Z")

</div>

Try following the steps outlined here:  
[[Loop over parameters](http://forum.dynare.org/t/loop-over-parameters/3335/1))  
to program a more efficient loop.  
The issue seems to be that you do not allow for stoch\_simul to fail, e.g. due to Blanchard-Kahn violations. In this case, the eigenvalues will not be computed/stored. At the previous link, you will see that

```auto
info=stoch_simul(var_list_)
```

is called. Here, info stores the exit code of stoch\_simul. If it is 0, everything is fine. If info\>0, the solution could not be computed and you need to attach a penalty for this outcome to deal with your optimizer.

---

_[View the full topic](https://forum.dynare.org/t/minimizing-negative-welfare/3416)._
