StateMachineAssembler: probabilistic jump
From Bcontrol
From the help file (In Matlab, >> help Modules/@StateMachineAssembler/add_probabilistic_jump )
% [sma] = add_probabilistic_jump(sma, state_name, prob_vector, states_vector)
%
% Adds a state from which the system immediately jumps out, fanning to
% another set of states with probability given by prob_vector.
%
% (Note: Requires a happenings-enabled @RTLSM2, Feb 2010 or later.)
%
% PARAMETERS:
% -----------
%
% sma The StateMachineAssembler object to which the states will be added.
%
% state_name A string, the name of the state from which the jumps happen.
% Jumping to this state will result in the probabilistic
% fanning out.
%
% prob_vector A doubles vector. The vector of probabilities of jumping to
% each of the states in the parameter state_vector (see
% below). Must be the same length as states_vector. All
% elements in prob_vector must be >= 0, and the
% sum(prob_vector) must be strictly > 0. The sum will be
% automatically normalized to 1 if it isn't already.
%
% states_vector A cell vector of strings. The names of the states that
% will be jumped to. Must be the same length as prob_vector.
%
%
% RETURNS:
% --------
%
% sma The updated StateMachineAssembler object.
%
%
% EXAMPLES:
% ---------
%
% >> sma = add_probabilistic_jump(sma, 'my_node', [0.1 0.4 0.5], ...
% {'state1', 'state2', 'state3'});
%
% Will add a state such that if we jump to state 'my_node', the state
% machine will immediately then jump to one of 'state1', 'state2', or
% 'state3', with probabilities 0.1, 0.4, and 0.5, respectively.
%