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
- Route Context — supplies
Graph,Service, the assignment variable, and the service/node assignment intermediates and .
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.
2. Service
A Route Context service whose traffic is allocated on graph edges.
3. Node
A Route Context graph node, either normal or client.
4. Assignment Counts
The Route Context exposes the registered intermediate values used here.
3. Variables
1. Decision Variables
The Kotlin declaration is UIntVariable2("y", Shape2(edges.size, services.size)); the range is set per edge in EdgeBandwidth.register. The Route Context variable
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.
NormalNode.
ClientNode.
2. Edge Incidence
5. Sets
1. Nodes
2. Edges
!from(normal) for this range assignment.
3. Services
4. Entity Pairs / Relations
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.
2. Service In-Degree Bandwidth
Description: ServiceBandwidth.inDegree is the bandwidth of service
3. Service Out-Degree Bandwidth
Description: ServiceBandwidth.outDegree is the bandwidth of service
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.
5. Node Aggregated In-Degree Bandwidth
Description: NodeBandwidth.inDegree aggregates all services entering each graph node.
6. Node Aggregated Out-Degree Bandwidth
Description: NodeBandwidth.outDegree aggregates service out-degree at normal nodes and uses a zero polynomial for client nodes.
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.
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.
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.
2. Bandwidth Is Nonnegative and Edge-Bounded
Description: Every normal-source edge variable is an unsigned integer bounded by that edge's maximum bandwidth.
3. Net Out-Flow Is a Definition, Not Conservation
Description: The implementation defines
8. Constraints
The active constraints are exactly the pipelines returned by
bandwidth_context/service/PipelineListGenerator.kt. A class existing inservice/limitsis 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.
Corollary: Since the Route Context constraint gives
2. Demand Constraint
Demand Constraint [需求约束]
Description: Every client node receives at least its declared demand through incoming service bandwidth.
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.
Corollary: The active inequality is algebraically equivalent to
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.
Corollary: This candidate is a one-sided out-flow gate only. It does not imply
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.
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 Name | File Path | Referenced In | Brief Description |
|---|---|---|---|
| DFS path extraction | service/SolutionAnalyzer.kt | BandwidthContext.analyze | Reads positive assignment and bandwidth tokens, then traces non-repeating edge links from assigned nodes to client nodes. |
11. Ubiquitous Language
| Term | Symbol | Definition |
|---|---|---|
| Bandwidth variable | Integer bandwidth allocated to service | |
| Edge total bandwidth | Sum of all service bandwidths on edge | |
| Service in-degree | Bandwidth of service | |
| Service out-degree | Bandwidth of service | |
| Service net out-flow | Service out-degree minus service in-degree at a normal node. | |
| Node in-degree | Incoming bandwidth aggregated across services. | |
| Node net out-flow | Net out-flow aggregated across services at a normal node. | |
| Service assignment count | Imported number of normal nodes assigned to service | |
| Normal-source edge | Edge whose source satisfies the normal predicate. | |
| Candidate node capacity | Sum of maximum outgoing edge bandwidths, used only by the unregistered transfer-node constraint. |
12. Design Decisions
| Decision | Alternatives | Rationale | Date |
|---|---|---|---|
| Declare | Use a real-valued or globally bounded array | Matches UIntVariable2 and the per-edge maxBandwidth range assignments. | Current source |
| Fix variables on non-normal-source edges to zero | Gate every edge only through a later constraint | This is an explicit registration range in EdgeBandwidth.register. | Current source |
| Define in-degree for all nodes but out-degree/out-flow as zero for clients | Define all three only on normal nodes | Matches the flatMap branches in ServiceBandwidth and NodeBandwidth. | Current source |
| Keep transfer-node gating as a separate class but omit it from the pipeline generator | Register it automatically with other bandwidth constraints | The current pipeline generator omits the class, so its inequality is not active. | Current source |
| Do not add flow conservation implicitly from net out-flow definitions | Register an equality such as | The source defines differences only; no conservation pipeline is returned. | Current source |
13. Change Log
| Version | Change | Reason |
|---|---|---|
| 1.0 | Rewritten as a 13-section, source-aligned domain model | Replace invented transfer formulas and incorrect assignment gates with the exact registered variables, intermediates, constraints, objective, and inactive-class status. |