seq_opt: Find optimal sequence

Description Usage Arguments Value

View source: R/seq-opt.R

Description

Given a list of timepoints and corresponding lists of possible states, efficiently finds an optimal state sequence that minimises an arbitrary transition cost function. The implementation uses dynamic programming to achieve complexity linear in the sequence length and quadratic in the number of possible states.

Usage

1
seq_opt(x, cost_funs, progress = FALSE)

Arguments

x

A nested list describing the possible states at the possible time points. Element x[[i]] should be a list describing the states available at timepoint i. Element x[[i]][[j]] should be the jth possible state at timepoint i.

cost_funs

A list of cost functions, with each cost function created by cost_fun(). When applied to a state transition, each cost function is computed, weighted by its weight parameter, and summed to provide the total cost. Decomposition of cost functions in this way has efficiency benefits when some of the cost functions are context-independent (i.e. the cost associated with moving to a state is independent of the previous state).

progress

Whether or not to show a progress bar.

Value

A list where element i corresponds to the optimal state at timepoint i.


pmcharrison/seqopt documentation built on Oct. 9, 2018, 7:38 p.m.