LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
runRewardAnalyzer.m
1function [V, t, names, stateSpace] = runRewardAnalyzer(self)
2% RUNREWARDANALYZER Compute steady-state and transient rewards
3%
4% [V, T, NAMES, STATESPACE] = RUNREWARDANALYZER(SELF)
5%
6% Computes both:
7% - Steady-state expected rewards using the CTMC stationary distribution:
8% E[r] = sum_s pi(s) * r(s)
9% - Transient value functions using uniformization with value iteration
10%
11% Results are cached in self.result.Reward for subsequent calls.
12%
13% OUTPUTS:
14% V - Cell array of value functions {nRewards x 1}
15% Each V{r} is [Tmax+1 x nStates] matrix
16% t - Time vector [1 x Tmax+1]
17% names - Cell array of reward names {nRewards x 1}
18% stateSpace - State space matrix [nStates x nDims]
19%
20% Copyright (c) 2012-2026, Imperial College London
21% All rights reserved.
22
23% Get network structure with rewards
24sn = self.model.getStruct(true);
25
26% Validate that rewards are defined
27if isempty(sn.reward)
28 error('No rewards defined. Use model.setReward(name, @(state) ...) before calling reward analysis.');
29end
30
31% Run the reward solver
32T0 = tic;
33[steadyState, names, stateSpace, pi, V, t] = solver_ctmc_reward(sn, self.options);
34runtime = toc(T0);
35
36% Cache results
37self.result.Reward.V = V;
38self.result.Reward.t = t;
39self.result.Reward.names = names;
40self.result.Reward.stateSpace = stateSpace;
41self.result.Reward.steadyState = steadyState;
42self.result.Reward.pi = pi;
43self.result.Reward.runtime = runtime;
44
45end