Skip to content

Bandwidth context model ​

1. Overview ​

The Bandwidth Context consumes the Route Context's graph, services, and assignment aggregate; it registers per-edge/per-service bandwidth variables, bandwidth intermediates, demand and capacity pipelines, and the bandwidth-cost objective. The authoritative implementation is BandwidthContext.kt, EdgeBandwidth.kt, and PipelineListGenerator.kt.

1. Dependent Contexts ​

  1. Route Context — supplies Graph, Service, the assignment variable xn,s, and the service/node assignment intermediates As and An.

2. Concepts / Entities ​

1. Edge ​

A directed edge from the Route Context graph. Only edges whose source is a normal node can receive a nonzero bandwidth variable in this context.

from(e) : The source node of edge e.

to(e) : The target node of edge e.

maxBandwidthe : The maximum bandwidth bound of edge e, an unsigned integer.

costPerBandwidthe : The per-unit bandwidth cost of edge e, an unsigned integer.

2. Service ​

A Route Context service whose traffic is allocated on graph edges.

capacitys : The service's bandwidth capacity, an unsigned integer.

costs : The service-use cost used by the Route Context objective, an unsigned integer.

3. Node ​

A Route Context graph node, either normal or client.

demandn : The incoming bandwidth requirement, defined for client nodes.

xn,s : The imported Route Context assignment variable; it is not redeclared by this context.

4. Assignment Counts ​

The Route Context exposes the registered intermediate values used here.

As : The number of normal nodes assigned to service s.

An : The number of services assigned to normal node n (and the zero polynomial for a client node).


3. Variables ​

1. Decision Variables ​

ye,s : Bandwidth allocated to service s on edge e, a nonnegative integer measured in the input bandwidth unit, with domain and registration bounds

0≤ye,s≤maxBandwidthe,∀e∈Enormal, ∀s∈S;ye,s=0,∀e∈Eclient, ∀s∈S.

The Kotlin declaration is UIntVariable2("y", Shape2(edges.size, services.size)); the range is set per edge in EdgeBandwidth.register. The Route Context variable xn,s is an imported decision variable, not a Bandwidth Context declaration.

2. Auxiliary Variables ​

No separate auxiliary decision variables are declared. All bandwidth totals and node/service flows in Section 6 are registered linear intermediate symbols.


4. Predicates ​

1. Node Type ​

Predicates classify entity sets; each predicate defines a subset.

normal(n) : Node n is a NormalNode.

client(n) : Node n is a ClientNode.

2. Edge Incidence ​

from(e)=n : Edge e leaves node n.

to(e)=n : Edge e enters node n.

from_normal(e) : The source of e satisfies normal; this is the derived filter used by all active edge bandwidth and cost pipelines.


5. Sets ​

1. Nodes ​

N : The universal set of nodes in the Route Context graph.

Nnormal : The normal/transit nodes, satisfying normal.

Nclient : The client/terminal nodes, satisfying client.

2. Edges ​

E : The universal set of directed graph edges.

Enormal : The subset {e∈E∣from(e)∈Nnormal}, whose ye,s variables have the edge maximum as their registration upper bound.

Eclient : The subset E∖Enormal, whose ye,s variables are fixed to zero. The source code uses !from(normal) for this range assignment.

3. Services ​

S : The Route Context's generated service set.

4. Entity Pairs / Relations ​

Rinc : The edge-to-node incidence relation represented by the source and target predicates from(e) and to(e); no separate relation variable is registered.


6. Intermediate Values ​

1. Edge Total Bandwidth ​

Description: EdgeBandwidth.bandwidth sums all service bandwidths on an edge. The implementation uses the zero polynomial for edges whose source is not normal.

Be={∑s∈Sye,s,e∈Enormal0,e∈Eclient∀e∈E

2. Service In-Degree Bandwidth ​

Description: ServiceBandwidth.inDegree is the bandwidth of service s entering node n through every edge whose target is n.

In,s=∑e∈E:to(e)=nye,s,∀n∈N, ∀s∈S

3. Service Out-Degree Bandwidth ​

Description: ServiceBandwidth.outDegree is the bandwidth of service s leaving a normal node. It is a zero polynomial for client nodes.

On,s={∑e∈E:from(e)=nye,s,n∈Nnormal0,n∈Nclient∀n∈N, ∀s∈S

4. Service Net Out-Flow ​

Description: ServiceBandwidth.outFlow subtracts service in-degree from service out-degree at normal nodes. It is not a conservation constraint.

Fn,s={On,s−In,s,n∈Nnormal0,n∈Nclient∀n∈N, ∀s∈S

5. Node Aggregated In-Degree Bandwidth ​

Description: NodeBandwidth.inDegree aggregates all services entering each graph node.

In=∑s∈SIn,s,∀n∈N

6. Node Aggregated Out-Degree Bandwidth ​

Description: NodeBandwidth.outDegree aggregates service out-degree at normal nodes and uses a zero polynomial for client nodes.

On={∑s∈SOn,s,n∈Nnormal0,n∈Nclient∀n∈N

7. Node Aggregated Net Out-Flow ​

Description: NodeBandwidth.outFlow aggregates service net out-flow at normal nodes and uses a zero polynomial for client nodes.

Fn={∑s∈SFn,s,n∈Nnormal0,n∈Nclient∀n∈N

8. Candidate Maximum Outgoing Capacity (Not a Registered Symbol) ​

Description: Node.maxOutDegree() computes the sum of maximum bandwidths on the node's attached outgoing edges for the unregistered TransferNodeBandwidthConstraint. It is a helper value, not an intermediate added by Aggregation.register.

Mn=∑e∈E:from(e)=nmaxBandwidthe,∀n∈Nnormal

7. Assertions ​

Assertions describe properties guaranteed by variable ranges and symbol construction. They do not imply an additional pipeline constraint.

1. Non-Normal-Source Edge Bandwidth Is Zero ​

Description: The range assignment in EdgeBandwidth.register fixes every service bandwidth variable on an edge whose source is not normal to zero.

∀e∈Eclient∀s∈S(ye,s=0)

2. Bandwidth Is Nonnegative and Edge-Bounded ​

Description: Every normal-source edge variable is an unsigned integer bounded by that edge's maximum bandwidth.

∀e∈Enormal∀s∈S(ye,s∈Z≥0 ∧ ye,s≤maxBandwidthe)

3. Net Out-Flow Is a Definition, Not Conservation ​

Description: The implementation defines Fn,s=On,s−In,s and Fn=∑sFn,s, but no pipeline registers On,s=In,s or another flow-conservation equality.

∀n∈Nnormal∀s∈S(Fn,s=On,s−In,s)

8. Constraints ​

The active constraints are exactly the pipelines returned by bandwidth_context/service/PipelineListGenerator.kt. A class existing in service/limits is not active unless that generator returns it.

1. Edge Bandwidth Constraint ​

Edge Bandwidth Constraint [边带宽约束]

Description: The service-level assignment count gates bandwidth on every normal-source edge. If a service is not assigned to any normal node, its bandwidth on each such edge is zero; if it is assigned once, the edge range still caps the bandwidth at the edge maximum.

s.t.(1−As)maxBandwidthe+ye,s≤maxBandwidthe,∀e∈Enormal, ∀s∈S

Corollary: Since the Route Context constraint gives As≤1, the inequality is equivalent to ye,s≤maxBandwidtheAs on the active domain.

(1−As)maxBandwidthe+ye,s≤maxBandwidthe ⟺ ye,s≤maxBandwidtheAs

2. Demand Constraint ​

Demand Constraint [需求约束]

Description: Every client node receives at least its declared demand through incoming service bandwidth.

s.t.In≥demandn,∀n∈Nclient

3. Service Capacity Constraint ​

Service Capacity Constraint [服务容量约束]

Description: At a normal node, service net out-flow is gated by the imported node-service assignment variable. The code permits negative net out-flow; it registers only this upper-bound inequality.

s.t.(1−xn,s)capacitys+Fn,s≤capacitys,∀n∈Nnormal, ∀s∈S

Corollary: The active inequality is algebraically equivalent to Fn,s≤capacitysxn,s.

(1−xn,s)capacitys+Fn,s≤capacitys ⟺ Fn,s≤capacitysxn,s

4. Transfer Node Bandwidth Constraint (Not Registered) ​

Transfer Node Bandwidth Constraint [传输节点带宽约束]

Description: TransferNodeBandwidthConstraint exists and would gate a normal node's aggregate net out-flow by the sum of its outgoing edge maxima. However, PipelineListGenerator returns only EdgeBandwidthConstraint, DemandConstraint, ServiceCapacityConstraint, and BandwidthCostObjective; it does not return this class. The following inequality is therefore not active in the current Demo1 model.

s.t.(1−An)Mn+Fn≤Mn,∀n∈Nnormal

Corollary: This candidate is a one-sided out-flow gate only. It does not imply On=In; no flow-conservation equality is registered anywhere in the current bandwidth pipeline list.


9. Objective Function (if applicable) ​

Description: BandwidthCostObjective minimizes the total cost of bandwidth on every edge whose source is a normal node, including the generated normal-to-client edges. The Route Context separately registers the service-cost objective.

minZbandwidth=∑e∈EnormalcostPerBandwidtheBe

10. Algorithm References ​

The only standalone algorithm-like operation used by this context after solving is DFS path extraction in SolutionAnalyzer.kt; it is not a model constraint or objective.

Algorithm NameFile PathReferenced InBrief Description
DFS path extractionservice/SolutionAnalyzer.ktBandwidthContext.analyzeReads positive assignment and bandwidth tokens, then traces non-repeating edge links from assigned nodes to client nodes.

11. Ubiquitous Language ​

TermSymbolDefinition
Bandwidth variableye,sInteger bandwidth allocated to service s on edge e.
Edge total bandwidthBeSum of all service bandwidths on edge e, or zero for a non-normal-source edge.
Service in-degreeIn,sBandwidth of service s entering node n.
Service out-degreeOn,sBandwidth of service s leaving normal node n.
Service net out-flowFn,sService out-degree minus service in-degree at a normal node.
Node in-degreeInIncoming bandwidth aggregated across services.
Node net out-flowFnNet out-flow aggregated across services at a normal node.
Service assignment countAsImported number of normal nodes assigned to service s.
Normal-source edgeEnormalEdge whose source satisfies the normal predicate.
Candidate node capacityMnSum of maximum outgoing edge bandwidths, used only by the unregistered transfer-node constraint.

12. Design Decisions ​

DecisionAlternativesRationaleDate
Declare y as an unsigned integer array and bound it per edgeUse a real-valued or globally bounded arrayMatches UIntVariable2 and the per-edge maxBandwidth range assignments.Current source
Fix variables on non-normal-source edges to zeroGate every edge only through a later constraintThis is an explicit registration range in EdgeBandwidth.register.Current source
Define in-degree for all nodes but out-degree/out-flow as zero for clientsDefine all three only on normal nodesMatches the flatMap branches in ServiceBandwidth and NodeBandwidth.Current source
Keep transfer-node gating as a separate class but omit it from the pipeline generatorRegister it automatically with other bandwidth constraintsThe current pipeline generator omits the class, so its inequality is not active.Current source
Do not add flow conservation implicitly from net out-flow definitionsRegister an equality such as On=InThe source defines differences only; no conservation pipeline is returned.Current source

13. Change Log ​

VersionChangeReason
1.0Rewritten as a 13-section, source-aligned domain modelReplace invented transfer formulas and incorrect assignment gates with the exact registered variables, intermediates, constraints, objective, and inactive-class status.