mapc_optimal.solver

Module Contents

Classes

Solver

The solver class coordinating the overall process of finding the optimal solution.

class mapc_optimal.solver.Solver(stations, access_points, mcs_values=len(DATA_RATES), mcs_data_rates=DATA_RATES, min_snr=MIN_SNRS, max_tx_power=MAX_TX_POWER, min_tx_power=MIN_TX_POWER, noise_floor=NOISE_FLOOR, min_throughput=0.0, opt_sum=False, max_iterations=100, epsilon=1e-05, solver=None)

The solver class coordinating the overall process of finding the optimal solution. It initializes the solver, sets up the network configuration, and manages the iterations. The optimization problem can be formulated in two ways: - the total throughput of the network is maximized, - the worst throughput of each node is maximized.

Examples

from mapc_optimal import Solver

# Define your network
# ...

solver = Solver(stations, access_points)
configurations, rate = solver(path_loss)

Note

The solver requires the path loss between each pair of nodes in the network. The reason for this is that the solver should be independent of the channel model used. Therefore, the path loss must be calculated beforehand. Note that if you do not require a specific channel model, you can use the provided function to calculate the path loss using the TGax channel model based on the positions of the nodes:

import numpy as np
from mapc_optimal import position_to_path_loss

# Positions of the nodes as an array of `x` and `y` coordinates. `i`-th row represents the position
# of the node with identifier `i` in the `stations` and `access_points` lists.
pos = np.array([
  [x_0, y_0],
  [x_1, y_1],
  ...
  [x_n-1, y_n-1]
])

# A matrix representing the walls in the environment (1 - wall, 0 - no wall between nodes `i` and `j`).
walls = np.zeros((n, n))
walls[i_0, j_0] = 1
walls[i_1, j_1] = 1
...
walls[i_m, j_m] = 1

# n x n matrix representing the path loss between each pair of nodes.
path_loss = position_to_path_loss(pos, walls)

Note

Identifiers of the stations and APs should be unique and cover the range from \(0\) to \(n - 1\) (where \(n\) is the total number of nodes in the network).

Note

The performance of the solver can significantly depend on the underlying mixed-integer linear programming solver. The default one is PULP_CBC, which is a free and open-source solver provided by the PuLP library. However, we recommend using a better solver, such as CPLEX.

Parameters:
  • stations (list) – Lists of numbers representing the stations.

  • access_points (list) – Lists of numbers representing the access points (APs) in the network.

  • mcs_values (int, default 12) – A number of MCS values available in the network. IEEE 802.11ax values are used by default.

  • mcs_data_rates (NDArray, default mapc_optimal.constants.DATA_RATES) – A list of data rates corresponding to the MCS values (Mb/s) IEEE 802.11ax single stream with 20MHz bandwidth and 800 ns GI data rates by default.

  • min_snr (NDArray, default mapc_optimal.constants.MIN_SNRS) – The minimum SNR required for a successful transmission (dB) for each MCS value. Empirically determined in ns-3 simulations by default.

  • max_tx_power (float, default 20.0) – The maximum transmission power (dBm) available.

  • min_tx_power (float, default 10.0) – The minimum transmission power (dBm) that can be used.

  • noise_floor (float, default -93.97) – The level of noise in the environment (dBm).

  • min_throughput (float, default 0.0) – The minimum throughput required for each node (Mb/s) while maximizing the total throughput.

  • opt_sum (bool, default False) – A boolean value indicating whether to maximize the sum of the throughput of all nodes in the network (True) or the minimum throughput of all nodes in the network (False).

  • max_iterations (int, default 100) – The maximum number of iterations of the solver.

  • epsilon (float, default 1e-5) – The minimum value of the pricing objective function to continue the iterations.

  • solver (pulp.LpSolver, default pulp.PULP_CBC_CMD(msg=False)) – The solver used to solve the optimization problems.

__call__(path_loss, return_objectives=False)

Solves the MAPC C-SR problem given the path loss between each pair of nodes in the network. Returns the final configurations, the time shares, and the total throughput.

Parameters:
  • path_loss (NDArray) – Matrix containing the path loss between each pair of nodes.

  • return_objectives (bool, default False) – Flag indicating whether to return the pricing objective values.

Returns:

result – Tuple containing the final configurations and the total throughput. Additionally, the solver can return a list of the pricing objective values for each iteration. It can be useful to check if the solver has converged.

Return type:

tuple[dict, float] or tuple[dict, float, list[float]]