function outvalue = COMPUTE_WELFARE()
% This function compute conditional welfare without input
% First edition: 2018/05/28

global oo_ M_ options_

% set_param_value('lambda_utility',par_value_lambda)  
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); %get decision rules
if info(1) %filter out error codes
    outvalue = 0;
end

%% simulate conditional welfare
initial_condition_states = repmat(oo_.dr.ys,1,M_.maximum_lag); % get steady state as initial condition
shock_matrix = zeros(2,M_.exo_nbr); % create shock matrix with number of time periods in columns
y_sim = simult_(initial_condition_states,oo_.dr,shock_matrix,options_.order); % simulate one period to get value

if ~options_.ramsey_policy
    outvalue = y_sim(strmatch('welfare',M_.endo_names,'exact'),2)*100; % read out gap
else
    oo_.steady_state = oo_.dr.ys;
    oo_.planner_objective_value = evaluate_planner_objective(M_,options_,oo_);
    outvalue = (oo_.planner_objective_value(1))*100;
end