flowr 1.0.0

Runners for compiled 'flow' programs
Documentation
flow = "path_tracker"

# Distance to next stop going forward
[[input]]
name = "forward"
type = "number"

# Distance crossing over from the other route
[[input]]
name = "cross"
type = "number"

# Forward distance on the other route
[[input]]
name = "other"
type = "number"

# The string we use to denominate we have selected the forward route
[[input]]
name = "forward_string"
type = "string"

# The string we use to denominate we have selected the cross route
[[input]]
name = "cross_string"
type = "string"

# The Route taken so far on the forward route
[[input]]
name = "forward_route"
type = "string"

# The distance taken on that route
[[input]]
name = "forward_distance"
type = "number"

# The Route taken so far on the other route
[[input]]
name = "other_route"
type = "string"

# The distance taken on that route
[[input]]
name = "other_distance"
type = "number"

# Intermediate value routed through parent to avoid internal clearing
[[input]]
name = "forward_total"
type = "number"

# Intermediate value routed through parent to avoid internal clearing
[[input]]
name = "cross_total"
type = "number"

#### Outputs

[[output]]
name = "route"
type = "string"

[[output]]
name = "distance"
type = "number"

# Intermediate outputs for parent to route back as external
[[output]]
name = "forward_total_out"
type = "number"

[[output]]
name = "cross_total_out"
type = "number"

############################### Definition #####################

# Sum the other two values to get the distance if we cross over
[[process]]
alias = "cross_distance"
source = "lib://flowstdlib/math/add"

[[connection]]
from = "input/cross"
to = "cross_distance/i1"

[[connection]]
from = "input/other"
to = "cross_distance/i2"

# Output cross_distance for parent to route back
[[connection]]
from = "cross_distance"
to = "output/cross_total_out"

# Accumulate the distances so_far - if we take the forward route
[[process]]
alias = "forward_sum"
source = "lib://flowstdlib/math/add"

[[connection]]
from = "input/forward_distance"
to = "forward_sum/i2"

[[connection]]
from = "input/forward"
to = "forward_sum/i1"

# Output forward_sum for parent to route back
[[connection]]
from = "forward_sum"
to = "output/forward_total_out"

# Accumulate the distances so_far - if we take the cross over route
# cross_sum gets cross_distance result back from parent as external
[[process]]
alias = "cross_sum"
source = "lib://flowstdlib/math/add"

[[connection]]
from = "input/other_distance"
to = "cross_sum/i2"

[[connection]]
from = "input/cross_total"
to = "cross_sum/i1"

# Compare the two distances so far — uses parent-routed forward_total
[[process]]
source = "lib://flowstdlib/math/compare"

[[connection]]
from = "input/forward_total"
to = "compare/left"

[[connection]]
from = "cross_sum"
to = "compare/right"

# select the string for the shortest route
[[process]]
alias = "select_string"
source = "lib://flowstdlib/control/select"

[[connection]]
from = "input/forward_string"
to = "select_string/i1"

[[connection]]
from = "input/cross_string"
to = "select_string/i2"

[[connection]]
from = "compare/lte"
to = "select_string/control"

# select the shortest route so far
[[process]]
alias = "select_route"
source = "lib://flowstdlib/control/select"

[[connection]]
from = "input/forward_route"
to = "select_route/i1"

[[connection]]
from = "input/other_route"
to = "select_route/i2"

[[connection]]
from = "compare/lte"
to = "select_route/control"

# select the total that corresponds to the lowest sum
[[process]]
alias = "select_total"
source = "lib://flowstdlib/control/select"

[[connection]]
from = "input/forward_total"
to = "select_total/i1"

[[connection]]
from = "cross_sum"
to = "select_total/i2"

[[connection]]
from = "compare/lte"
to = "select_total/control"

# Accumulate the shortest route so far
[[process]]
source = "lib://flowstdlib/data/append"

[[connection]]
from = "select_route/select_i1"
to = "append/s1"

[[connection]]
from = "select_string/select_i1"
to = "append/s2"

#  output the distance so far
[[connection]]
from = "select_total/select_i1"
to = "output/distance"

# output route so far
[[connection]]
from = "append"
to = "output/route"