1function [stateSpace,stateSpaceAggr,stateSpaceHashed,nodeStateSpace,sn] = ctmc_ssg(sn,options)
3if isfield(sn,
'fjsync') && ~isempty(sn.fjsync)
4 % fork firings
break per-chain population conservation, so
the
5 % population-lattice enumeration cannot generate FJ state spaces
6 line_error(mfilename,
'Fork-join models require reachability-based state space generation (options.config.state_space_gen=''reachable'').');
9[stateSpace,stateSpaceHashed,qnc] = State.spaceGenerator(sn, options.cutoff, options);
10nodeStateSpace = qnc.space;
11sn.space = nodeStateSpace;
14% line_printf(
'\nCTMC state space size: %d states. ',size(stateSpace,1));
16if ~isfield(options,
'hide_immediate')
17 options.hide_immediate = true;
20nstateful = sn.nstateful;
21nclasses = sn.nclasses;
24stateSpaceAggr = zeros(size(stateSpaceHashed));
26% for all synchronizations
28 stateCell = cell(nstateful,1);
29 for s=1:size(stateSpaceHashed,1)
30 state = stateSpaceHashed(s,:);
31 % update state cell array and SSq
34 isf = sn.nodeToStateful(ind);
35 stateCell{isf} = sn.space{isf}(state(isf),:);
37 ist = sn.nodeToStation(ind);
38 [~,nir] = State.toMarginal(sn,ind,stateCell{isf});
40 stateSpaceAggr(s,((ist-1)*nclasses+1):ist*nclasses) = nir;