Dynamic Programming Tree Solver

TreeLas.TreeDPModule

Dynamic Programming Tree Solver

Merge the event queues within the tree by sorting arrays.

Compared to previous versions, all weighting (λ and μ) is templated; thus we only need one implementation and the compiler will do the rest.

source
TreeLas.TreeDP.tree_dpFunction
tree_dp(y, t::Tree, λ [, μ = 1.0])

Perform the dynamic programming algorithm on y and return the optimized x.

The edge weighting λ should be either a constant (e.g. Float64) or a callable such that λ(i) returns the weight of the edge (i, t.parent[i]); for λ(t.root) it might return anything but not causean error.

source
TreeLas.TreeDP.tree_dp!Function
tree_dp!(x, y, t, λ, μ [,mem])

Like tree_dp but do not allocate an output buffer for x.

If mem::TreeDPMem is provided, no additional allocations will be needed.

source
GraphIdx.Tree.reset!Function
reset!(mem::TreeDPMem, t::Tree)

Re-initialize the memory given the new tree, i.e.

  1. Assert that mem has the required size for t.
  2. Compute processing order.
  3. Initialize queues to fit t.
source

Dual Solution

TreeLas.Dual.gap_vec!Function
gap_vec!(γ, dif, x, y, D, Dt, α, c)

Compute the gap vector (modifies dif and x) and stores it in γ.

Warning

This is the old method using Julia's SparseArrays.SparseMatrixCSC.

source
TreeLas.Dual.gap_vec!Method
gap_vec!(γ, x, α, g [, c = 1.0])

Compute the duality gap: for each edge e we set γ[e] to the difference of the edge cost $\lambda_{ij} |x_i - x_j|$ and the linear approximation via the dual $α_{ij}(x_i - x_j)$.

The graph g needs to implement a method enumerate_edges(::Function, g).

If provided, the result is multiplied by c.

source
TreeLas.Dual.wolfe_gap_stepMethod
wolfe_gap_step(x0, α0, x1, α1)

Optimal gap step width according to Wolfe's condition, i.e. compute the optimal step width $θ ∈ [0, 1]$ to walk from (x0, α0) to (x1, α1) such that the sum(gap_vec) will be minimized.

source

Queues-Structure

The main component is a set of double-ended, mergable priority queues (also called heaps).

TreeLas.Pwl.QueueUnion.QueuesType

Set of double ended queues (DeQue) in a tree. Initially all leaf nodes have its own queue. Children's queues will be merged into the parent node.

source