cost_by_prev_state: Get cost by previous states

Description Usage Arguments Value

View source: R/costs.R

Description

Returns costs for moving to a given state from a vector of previous states.

Usage

1
2
cost_by_prev_state(prev_state_values, new_state_value, cost_funs, weights,
  exp_cost, profile = FALSE)

Arguments

prev_state_values

List of potential previous states, over which this function is vectorized.

new_state_value

State to move to.

cost_funs

Named list of cost functions, each created by cost_fun.

weights

Numeric vector of weights for these cost functions.

exp_cost

(Logical scalar) Whether the total costs should be exponentiated (after summing over the cost functions).

profile

(Logical scalar) Whether to profile the time taken to compute each cost function. If TRUE, profile information will be returned in the "time" attribute of the output object.

Value

A numeric vector of costs of the same length as prev_state_values, corresponding to the cost associated with moving from that previous state to the new state.


pmcharrison/seqopt documentation built on May 22, 2019, 6:35 p.m.