LorranSutter / Radar-positioning

Solve a radar positioning problem using linear programming

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Radar Positioning

Project created to solve a radar positioning problem using linear programming concepts, part of Operations Research course of Universidade Federal de Juiz de Fora

You can also check a linear solution to solve Sudoku here.

Problem presentation  |   Dependencies  |   How to run  |   Linear programming  |   Linear model  |   Resources  

πŸ“‘ Problem presentation

We have a 2D region with signal demands to be met by a set of radars. We want to maximize the number of demands met and with better signal quality.

As seen in the images below, we have two solutions for a region with 100 (left) and 2500 (right) points that radars can be positioned (black dots), 20 (left) and 1000 (right) demands to be met and a limit of 10 (left) and 200 (right) radars (blue circles). The red dots represents demands that could not be met and the green dots demands that were met.

There are two possible variations for this problem:

  1. Fixed number of radars to cover demands.
  2. No limit of radar to cover demands. In this case, in addition than maximize the number of demands met with better signal, we also minimize the number of radars needed to cover all demands.

πŸ“ Dependencies

Besides, of course, Python, gurobipy library must be installed too. Installation instructions in Gurobi.

If you want to visualize the results as in the image above, you will need PyOpenGL.

πŸƒ How to run

Open your terminal in the folder you want to clone the project

git clone https://github.com/LorranSutter/Radar-positioning.git

The script Instance_generator.py generates a random instance to be solved and the inputs are as follows:

  • Int β†’ Number of demands
  • Int β†’ Max number of radars (optional)
  • Float β†’ Max reach radius of radar signal (optional) [1-50]
  • Int β†’ Number of points in x direction
  • Int β†’ Number of points in y direction
python3 Instance_generator.py <list of inputs>

The script Radar_max.py is the main variation of the problem, with a fixed number of radars. There is only one input, which are the files in Instances folder.

python3 Radar_max.py Instances/<file>

The script Radar_min.py is the second variation of the problem, with no limit of radars. The input is the same as the above.

python3 Radar_min.py Instances/<file>

Finally, the script Display_terrain.py uses OpenGL to show the results of the previous scripts. Inputs needs two files, one from InstancesPoints folder and other from Solutions folder. Both must have the same suffixes, for example, instance_Points49_10_5 and instance49_10_5_out.sol

python3 Display_terrain.py InstancesPoints/<file> Solutions/<file>

✏️ What is linear programming?

Linear programming is a technique used to solve optimization problems where the elements have a linear relationship.

Linear programs aims to maximize a objective function made of decision variables subject to constraints which ensures that all the elements have a linear relationship and all variables are non-negative.

πŸ“ Radar positioning model

For this problem, we want to maximize the number of demands met and with better signal quality. The meaning of the variables and parameters is as follows:

  • $xj$ β†’ Radar j in the position j

  • $yi$ β†’ Demand i

  • $zij$ β†’ It says whether the demand i has been me by the radar j

  • $Aij$ β†’ It says the signal quality of the radar j fot the demand i

  • $m$ β†’ Number of demands

  • $n$ β†’ Number of locations where the radars may be positioned

  • $p$ β†’ Max number of radars

$$\qquad\qquad\> \ \text{Max} \quad \sum_{i=1}^{m}y_i \ + \sum_{i=1}^{m}\sum_{j=1}^{n}A_{ij}z_{ij}$$

$$\text{Subject to} \ \sum_{j=1}^{n}z_{ij} \ = \ y_{i} \ \forall i$$

$$\qquad\>\>\>\sum_{j=1}^{m}x_{j} \ = \ p$$

$$\qquad\qquad\qquad\qquad\quad \ x_j\ge z_{ij} \quad \forall{i} \forall{j} \ \text{and} \ A_{ij} \ \neq \ 0$$

$$\qquad\qquad\quad\>x_j,y_i,z_{ij} \ \in \ [0,1]$$

Each row of the model above is explained as follows:

  1. Objective function that aims to maximize the sum of demands met and the signal quality on demand.
  2. Number of demands met must be equals to number of demands.
  3. Number of radars in position j must be equals to the max number of radars available.
  4. Number of radars in position j must be grater or equals to the demands met by this radar in the position j.
  5. All radars, demand and demand met must be 0 or 1.

πŸ“– Resources and technologies πŸ’»

  • Gurobi - mathematical optimization solver
  • Python - interpreted, high-level, general-purpose programming language
  • PyOpenGL - rendering library to run OpenGL API using Python

About

Solve a radar positioning problem using linear programming


Languages

Language:Python 100.0%