Let's consider a telecommunication network consisting of
-
Find all
$N$ non-loop routes$Rt$ from node$k$ to node$l$ . This can be done manually. For a high grade, it is necessary to develop and implement an algorithm that constructs such routes. The use of a library function is permitted. -
Number all possible routes from
$1$ to$n$ and associate each of them with a corresponding delay time$t_i$ , equal to the sum of times over all edges of route$i$ . -
Introduce binary variables
$x_i$ ,$i=1,...,n$ as variables. Here$x_i=1$ if route number$i$ is selected and$x_i=0$ otherwise. Then the objective function to be minimized will be: $$F(\vec{x})=\sum_{i=1}^{N}t_ix_i\$$ Since it is necessary to find$r$ independent channels, the first constraint takes the form (in the simplest case for dual redundancy$r=2$ ):$$\sum_{i=1}^{N}x_i=r$$ -
Next, it is required to construct resource constraints for routes. The columns of the constraint matrix will be routes, and the rows will be the involved routers and communication lines. Therefore, for all routes that jointly use a router (communication line), the constraint can be written as:
$$\sum_{i\in V(Rt)} x_i \leq SR\ \sum_{i\in E(Rt)} x_i \leq SP$$ In graph theory, the set of vertices of a graph
$g$ is denoted as$V(g)$ , and the set of its edges as$E(g)$ . -
Solve the integer linear programming problem.
-
Construct a graph with the identified routes highlighted.
- Find all non-loop routes usin R all_simple_paths function.
- Define calculate_time_delay function to calculate time delay of each route. Save this values in time_delays.
- Create limmitations for simplex method with binary varibals.
- Solve task:
optimum <- lp( direction = "min", objective.in = Fun, const.mat = A, const.dir = CD, const.rhs = B, all.bin = TRUE ) - Show find routes on graph plot.



