Variable: Flow
@kortexya/reasoninglayer / Flow
Variable: Flow
Section titled “Variable: Flow”
constFlow:object
Defined in: src/builders/flow.ts:223
Type Declaration
Section titled “Type Declaration”classifyEdges()
Section titled “classifyEdges()”classifyEdges(
input):FlowBuilderProblem<ClassifyEdgesVars>
Build a Dulmage-Mendelsohn edge-classification problem.
Each edge is classified as "always", "never", or
"sometimes" used across the space of all max flows (or all
min-cost max flows when optimal: true).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”FlowBuilderProblem<ClassifyEdgesVars>
classifyEdgesObjective()
Section titled “classifyEdgesObjective()”classifyEdgesObjective(
opts):TermInputArg
Low-level: build a single flow_classify_edges_constraint psi-term.
Parameters
Section titled “Parameters”classifications
Section titled “classifications”string
optimal?
Section titled “optimal?”boolean
string
source
Section titled “source”string
Returns
Section titled “Returns”edge()
Section titled “edge()”edge(
from,to,cap,options?):TermInputArg
Low-level: build a single flow_edge_constraint psi-term.
Parameters
Section titled “Parameters”string
string
number
options?
Section titled “options?”FlowEdgeOptions = {}
Returns
Section titled “Returns”maxFlow()
Section titled “maxFlow()”maxFlow(
input):FlowBuilderProblem<MaxFlowVars>
Build a max-flow problem.
Emits one flow_edge_constraint per edge, one
flow_max_constraint with the requested output binding, and a
flow_solve_constraint trigger. Returns the constraint terms
plus the names of every output variable.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”FlowBuilderProblem<MaxFlowVars>
maxObjective()
Section titled “maxObjective()”maxObjective(
opts):TermInputArg
Low-level: build a single flow_max_constraint psi-term.
Parameters
Section titled “Parameters”flowValue
Section titled “flowValue”string
string
source
Section titled “source”string
Returns
Section titled “Returns”Example
Section titled “Example”const constraints = [ Flow.edge('s', 'a', 10), Flow.edge('a', 't', 10), Flow.maxObjective({ source: 's', sink: 't', flowValue: '?V' }), Flow.solve('s', 't'),];minCostMaxFlow()
Section titled “minCostMaxFlow()”minCostMaxFlow(
input):FlowBuilderProblem<MinCostMaxFlowVars>
Build a min-cost-max-flow problem. Per-edge cost is required
for the optimisation to be meaningful (defaults to 0 if absent).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”FlowBuilderProblem<MinCostMaxFlowVars>
minCostMaxFlowObjective()
Section titled “minCostMaxFlowObjective()”minCostMaxFlowObjective(
opts):TermInputArg
Low-level: build a single flow_min_cost_max_flow_constraint psi-term.
Parameters
Section titled “Parameters”flowValue
Section titled “flowValue”string
string
source
Section titled “source”string
totalCost
Section titled “totalCost”string
Returns
Section titled “Returns”minCut()
Section titled “minCut()”minCut(
input):FlowBuilderProblem<MinCutVars>
Build a min-cut problem.
Emits flow_min_cut_constraint and binds cut_value,
cut_edges, source_side, sink_side to the requested
variable names (auto-generated when omitted).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”FlowBuilderProblem<MinCutVars>
minCutObjective()
Section titled “minCutObjective()”minCutObjective(
opts):TermInputArg
Low-level: build a single flow_min_cut_constraint psi-term.
Parameters
Section titled “Parameters”cutEdges
Section titled “cutEdges”string
cutValue
Section titled “cutValue”string
string
sinkSide
Section titled “sinkSide”string
source
Section titled “source”string
sourceSide
Section titled “sourceSide”string
Returns
Section titled “Returns”node()
Section titled “node()”node(
name):object
Low-level: get the node-variable reference used to identify a node name in goals built by this builder. Exposed so callers composing constraints by hand can refer to the same logical node the high-level helpers would produce — e.g., to add a feature test on the same node term inside the same goal.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”object
name:
string
solve()
Section titled “solve()”solve(
source,sink):TermInputArg
Low-level: build a single flow_solve_constraint psi-term.
Parameters
Section titled “Parameters”source
Section titled “source”string
string