Route context model
1. Overview
The Route Context builds the Graph, generated Service list, and service-to-node assignment aggregate from the demo input; it supplies the route variables and route-side pipelines consumed by the Bandwidth Context. The authoritative implementation is the Kotlin demo1 source, especially RouteContext.kt, Assignment.kt, and PipelineListGenerator.kt.
1. Dependent Contexts
None. The Bandwidth Context depends on this context's graph, services, assignment variables, and assignment intermediate symbols.
2. Concepts / Entities
1. Node
A graph vertex. A node is either a NormalNode, which can host a service, or a ClientNode, which has a bandwidth demand. The Kotlin object identity distinguishes graph nodes; the input client identifier is not assumed to be globally unique with normal-node identifiers.
RouteContext.init.
1.1 Normal Node
A transit/hosting node created for each index from normalNodeAmount - 1. Only normal nodes have free route-assignment rows and outgoing bandwidth variables with nonzero registration bounds.
1.2 Client Node
A terminal node created from a ClientNodeDTO; it consumes bandwidth and has no free service-assignment row.
2. Edge
A directed graph edge. For each input EdgeDTO, initialization creates one edge in each direction with the same maximum bandwidth and unit cost. For each client, initialization adds one edge from its linked normal node to the client, with maximum bandwidth equal to the client demand and zero unit cost.
3. Service
A candidate service that may be assigned to one normal node and whose bandwidth is allocated by the dependent Bandwidth Context.
RouteContext.init, every generated service receives the total client demand.
input.serviceCost.
4. Graph
The route aggregate's network container, holding the node and directed-edge lists.
3. Variables
1. Decision Variables
Assignment.register; the unknown decision rows are therefore
2. Auxiliary Variables
No separate auxiliary decision variables are declared. The registered assignment counts are intermediate symbols defined in Section 6.
4. Predicates
1. Node Type
Predicates classify entity sets; each predicate defines a subset.
NormalNode.
ClientNode.
2. Edge Incidence
5. Sets
1. Nodes
Graph.nodes.
2. Edges
Graph.edges, including both generated directions for each input edge and the generated normal-to-client edges.
3. Services
normalNodeAmount, then RouteContext.init creates
4. Entity Pairs / Relations
The implementation uses the edge incidence relations
6. Intermediate Values
1. Node Assignment Count
Description: The number of services assigned to a node. Assignment.register sums the binary rows for normal nodes and installs the zero polynomial for client-node rows.
2. Service Assignment Count
Description: The number of normal nodes assigned to service
3. Generated Service Capacity and Count
Description: These are input-derived entity attributes rather than model symbols. Let normalNodeAmount.
The generated service cost is
7. Assertions
Assertions are properties that always hold in the registered route aggregate and its data shape.
1. Client Assignment Rows Are Fixed
Description: Assignment.register fixes every client-node row of the binary variable array to false.
2. Client Assignment Count Is Zero
Description: Because client rows are represented by zero polynomials, the node assignment intermediate for every client is zero.
3. Assignment Counts Are Bounded by Their Registered Binary Rows
Description: Before the route pipelines are applied, the sums are nonnegative and integral; the active constraints in Section 8 impose the upper bounds
8. Constraints
Constraints are the route pipelines returned by
route_context/service/PipelineListGenerator.kt; the assignment variable ranges are registered byAssignment.registerbefore those pipelines run.
1. Node Assignment Constraint
Node Assignment Constraint [节点分配约束]
Description: A normal node hosts at most one service.
2. Service Assignment Constraint
Service Assignment Constraint [服务分配约束]
Description: A service is assigned to at most one normal node. It may remain unassigned in this context; client demand and edge gating are enforced by the dependent bandwidth pipelines.
9. Objective Function (if applicable)
Description: ServiceCostObjective minimizes the sum of each generated service's cost when that service is assigned. This context registers this objective in addition to the bandwidth objective registered by the dependent context; the source does not state a weighted or lexicographic combination.
10. Algorithm References
No standalone algorithm document is referenced by the Route Context domain model. Route initialization and pipeline construction are ordinary context operations in RouteContext.kt and PipelineListGenerator.kt.
| Algorithm Name | File Path | Referenced In | Brief Description |
|---|---|---|---|
| None | — | — | No standalone route algorithm is registered. |
11. Ubiquitous Language
| Term | Symbol | Definition |
|---|---|---|
| Node | A graph node object. | |
| Normal node | A transit/hosting node eligible for service assignment. | |
| Client node | A terminal node with incoming demand. | |
| Edge | A directed graph edge. | |
| Service | A generated candidate service. | |
| Assignment | Binary decision that places a service at a normal node. | |
| Node assignment count | Number of services assigned to node | |
| Service assignment count | Number of normal nodes assigned to service | |
| Demand | Required incoming bandwidth of client node |
12. Design Decisions
| Decision | Alternatives | Rationale | Date |
|---|---|---|---|
| Materialize two directed edges for each input edge | Keep the input edge undirected | The source constructs and indexes both directions explicitly. | Current source |
| Add one normal-to-client edge with demand capacity and zero cost | Represent demand only as a node equation | The current graph lets incoming bandwidth satisfy each client through an explicit edge. | Current source |
| Generate | Read service count and capacities from separate input fields | This is the exact RouteContext.init demo rule. | Current source |
| Fix client rows of | Leave all node rows free | Client nodes are consumers, not service hosts, in the implemented model. | Current source |
13. Change Log
| Version | Change | Reason |
|---|---|---|
| 1.0 | Rewritten as a 13-section, source-aligned domain model | Replace shorthand and unsupported route formulas with the actual Kotlin registration semantics. |