From 660fc64471fb4e3bda5bd1689180522485ee41cc Mon Sep 17 00:00:00 2001
From: Michel Juillard <michel.juillard@mjui.fr>
Date: Sun, 8 Nov 2015 16:51:06 +0100
Subject: [PATCH] adding check for model size before computing value of planner
 objective.

---
 matlab/evaluate_planner_objective.m | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/matlab/evaluate_planner_objective.m b/matlab/evaluate_planner_objective.m
index 69f24c6e5b..9edb400238 100644
--- a/matlab/evaluate_planner_objective.m
+++ b/matlab/evaluate_planner_objective.m
@@ -32,6 +32,12 @@ dr = oo.dr;
 exo_nbr = M.exo_nbr;
 nstatic = M.nstatic;
 nspred = M.nspred;
+if nspred > 180
+    disp(' ')
+    disp(['evaluate_planner_objective: model too large, can''t evaluate planner ' ...
+          'objective'])
+    return NaN
+end
 beta = get_optimal_policy_discount_factor(M.params,M.param_names);
     
 Gy = dr.ghx(nstatic+(1:nspred),:);
-- 
GitLab