API Reference

DecisionProgramming.jl API reference.

influence_diagram.jl

Nodes

DecisionProgramming.StatesMethod

Construct states from vector of (state, nodes) tuples.

Examples

julia> S = States([(2, [1, 3]), (3, [2, 4, 5])])
States([2, 3, 2, 3, 3])
source

Paths

DecisionProgramming.pathsFunction

Iterate over paths in lexicographical order.

Examples

julia> states = States([2, 3])
julia> vec(collect(paths(states)))
[(1, 1), (2, 1), (1, 2), (2, 2), (1, 3), (2, 3)]
source

Iterate over paths with fixed states in lexicographical order.

Examples

julia> states = States([2, 3])
julia> vec(collect(paths(states, Dict(1=>2))))
[(2, 1), (2, 2), (2, 3)]
source

Probabilities

DecisionProgramming.ProbabilitiesType

Construct and validate stage probabilities.

Examples

julia> data = [0.5 0.5 ; 0.2 0.8]
julia> X = Probabilities(2, data)
julia> s = (1, 2)
julia> X(s)
0.5
source

Path Probability

Consequences

Path Utility

Decision Strategy

decision_model.jl

Decision Model

DecisionProgramming.active_paths_cutMethod

Adds a active paths cut to the model as a lazy constraint.

Examples

atol = 0.9  # Tolerance to trigger the creation of the lazy cut
active_paths_cut(model, π_s, S, P; atol=atol)
source

Objective Functions

DecisionProgramming.PositivePathUtilityType

Positive affine transformation of path utility. Always evaluates positive values.

Examples

julia> U⁺ = PositivePathUtility(S, U)
julia> all(U⁺(s) > 0 for s in paths(S))
true
source

Decision Strategy from Variables

analysis.jl

DecisionProgramming.CompatiblePathsType

Interface for iterating over active paths given influence diagram and decision strategy.

  1. Initialize path s of length n
  2. Fill chance states s[C] by generating subpaths paths(C)
  3. Fill decision states s[D] by decision strategy Z and path s

Examples

for s in CompatiblePaths(S, C, Z)
    ...
end
source
DecisionProgramming.StateProbabilitiesMethod

Associates each node with array of conditional probabilities for each of its states occuring in active paths given fixed states and prior probability.

Examples

# Prior probabilities
prev = StateProbabilities(S, P, Z)

# Select node and fix its state
node = 1
state = 2
StateProbabilities(S, P, Z, node, state, prev)
source

printing.jl

DecisionProgramming.print_state_probabilitiesFunction

Print state probabilities with fixed states.

Examples

sprobs = StateProbabilities(S, P, U, Z)
print_state_probabilities(sprobs, [c.j for c in C])
print_state_probabilities(sprobs, [d.j for d in D])
source

random.jl

DecisionProgramming.random_diagramMethod

Generate random decision diagram with n_C chance nodes, n_D decision nodes, and n_V value nodes. Parameter m_C and m_D are the upper bounds for the size of the information set.

Examples

rng = MersenneTwister(3)
random_diagram(rng, 5, 2, 3, 2)
source
DecisionProgramming.ProbabilitiesMethod

Generate random probabilities for chance node c with S states.

Examples

rng = MersenneTwister(3)
c = ChanceNode(2, [1])
S = States([2, 2])
Probabilities(rng, c, S)
source
DecisionProgramming.ConsequencesMethod

Generate random consequences between low and high for value node v with S states.

Examples

rng = MersenneTwister(3)
v = ValueNode(3, [1])
S = States([2, 2])
Consequences(rng, v, S; low=-1.0, high=1.0)
source
DecisionProgramming.LocalDecisionStrategyMethod

Generate random decision strategy for decision node d with S states.

Examples

rng = MersenneTwister(3)
d = DecisionNode(2, [1])
S = States([2, 2])
LocalDecisionStrategy(rng, d, S)
source