1%{ @file sn_is_state_valid.m
2 % @brief Validates a network state
4 % @author LINE Development Team
8 % @brief Validates a network state
11 % Checks
if a given state vector represents a valid state
for the network.
15 %
bool = sn_is_state_valid(sn)
20 % <tr><th>Name<th>Description
21 % <tr><td>sn<td>Network structure
26 % <tr><th>Name<th>Description
27 % <tr><td>bool<td>True
if the state
is valid
for this network
30function [isvalid] = sn_is_state_valid(sn)
31% [ISVALID] = ISSTATEVALID()
35 isf = sn.stationToStateful(ist);
36 if size(sn.state{isf},1)>1
37 line_warning(mfilename,sprintf(
'isStateValid will ignore some states of station %d, define a unique initial state to address this problem.\n',ist));
38 sn.state{isf} = sn.state{isf}(1,:);
40 [~, nir(ist,:), sir(ist,:), ~] = State.toMarginal(sn, sn.stationToNode(ist), sn.state{isf});
42isvalid = State.isValid(sn, nir, sir);