Skip to content

Results are limited to Maximum Independent Set v0.2.3

Product news
You are reading Maximum Independent Set v0.2.3, an older version of this documentation. Go to the latest version (v0.3.2)

mis.data

package
mis.data

Classes

  • DataLoader — DataLoader class to handle loading of coordinates from CSV files, calculating distances between coordinates, and building a Maximum Independent Set (MIS) instance.

class
DataLoader ()

DataLoader class to handle loading of coordinates from CSV files, calculating distances between coordinates, and building a Maximum Independent Set (MIS) instance.

Attributes

  • coordinates_dataset : list[tuple[float, float]] — A list of tuples representing coordinates (latitude, longitude).

Methods

  • distance_from_coordinates — Calculate the distance between two geodesic coordinates.

  • load_from_csv_coordinates — Load coordinates from a CSV file. The CSV file should have a column named 'coordonnees' with coordinates in the format "lat,lon".

  • build_mis_instance_from_coordinates — Build a Maximum Independent Set (MIS) instance from the loaded coordinates. The function creates a graph where nodes represent antennas and edges represent connections between antennas that are within the specified range. Args: antenna_range (float): The maximum distance between antennas to consider them connected. antennas (set[int], optional): A set of indices representing the antennas to include in the graph. If None, all antennas in the dataset are included. Returns: MISInstance: An instance of the Maximum Independent Set problem represented as a graph.

staticmethod
distance_from_coordinates (coord1: tuple[float, float], coord2: tuple[float, float]) → float

Calculate the distance between two geodesic coordinates.

Parameters

  • coord1 : tuple[float, float] — The first coordinate as a tuple (latitude, longitude).

  • coord2 : tuple[float, float] — The second coordinate as a tuple (latitude, longitude).

Returns

  • float — The distance between the two coordinates in kilometers.

method
load_from_csv_coordinates (file_path: Path) → None

Load coordinates from a CSV file. The CSV file should have a column named 'coordonnees' with coordinates in the format "lat,lon".

Parameters

  • file_path : Path — The path to the CSV file containing coordinates.

Raises

  • FileNotFoundError

  • ValueError

method
build_mis_instance_from_coordinates (antenna_range: float, antennas: set[int] = None) → MISInstance

Build a Maximum Independent Set (MIS) instance from the loaded coordinates. The function creates a graph where nodes represent antennas and edges represent connections between antennas that are within the specified range. Args: antenna_range (float): The maximum distance between antennas to consider them connected. antennas (set[int], optional): A set of indices representing the antennas to include in the graph. If None, all antennas in the dataset are included. Returns: MISInstance: An instance of the Maximum Independent Set problem represented as a graph.

Raises

  • ValueError