So I'm trying to optimize the following hint problem. I have a series of sensors (cameras) and a set of targets. Each camera can be aimed directly at a target, but based on the FOV, it can see multiple targets. The goal is to cover as many targets as possible with the user-defined number of cameras (eg stereo, 2).

I initially chose MATLAB and intlinprog and will show the wording. However, since I am new to MILP, I am open to criticism and suggestions

Problem formulation

given:

*S* sensors
*T* aims
*P* Show options for everyone *S* sensor
*T* == *P*
*R* required degree of coverage (ie 2 for stereo or 1 for mono)

Problem structure:

The source data for the problem is logical / binary 3D arrays *Vis* (P x T x S) indicated *(i, j, k)*

- Each layer (3rd dimension
*S*) represents a camera
- Each line in a plane represents a pointing function
- The column is in a specific row and level
*true* when the goal is seen

*Vis* (i, j, k) = *true* if *camera*(k) can see *aim* (j) using the pointing function (i)

Limitations:

- Each camera can only be assigned a pointing function

Goal: Maximize the number of goals that have at least reached the required coverage level.

I will insert an example of my code below. Some comments are that I take the matrix from *Vis* and convert it to a 2D array by concentrating each "layer" along the first dimension.

There is a binary decision variable for each pointing function for each camera and a binary switching variable that can be used to optimize the number of targets with the desired coverage level.

```
S = 156; % 100 cameras
T = 100; % 100 goals
P = T; % 100 pointing options
R = 2; % Required degree of care (stereo)
% Load Vis Matrix is (P x T X S)
% If the matrix is very scattered, the solver works fine. The problem is
% Some cameras can see a lot of targets, others no
load (& # 39; Vis.mat & # 39;);
% Use the permutation and transformation matrix so that each level of the "3rd" Dimension is located in a plane
% focused on the bottom of the previous one
VisNew = permute (Vis,[1 3 2]);
VisNew = reshape (VisNew,[]Size (Vis, 2), 1);
[m,n] = Size (VisNew);
Set %% optimization problem
% The first set of variables is the logical t / f for pointing
% Option (m). The last sentence of Logic t / f will be the coverage variable (s)
NumVars = m + n;
% All variables are integers
prob_struct.intcon = 1: NumVars;
% All variables have lb of 0 and ub of 1
prob_struct.lb = zeroes (NumVars, 1);
prob_struct.ub = ones (NumVars, 1);
% The "maximize" (min for the function) is the sum of the "Required
% Coverage "Switching variables that apply only when needed
% Coverage is received
prob_struct.f = [zeros(m,1); -1*ones(n,1)];
% The equality constraint results from the fact that every camera can only
% 1 Show option is assigned. So the sum of these option variables for each
% Camera should be 1
prob_struct.Aeq = zeros (S, NumVars);
for x = 1: S
prob_struct.Aeq (x, ((x-1) * P + 1: x * P)) = 1;
The End
prob_struct.beq = ones (S, 1);
% The inequality condition only ensures the coverage
The variable% will only be switched if there is sufficient coverage for this target
prob_struct.Aineq = [VisNew'.*-1 R.*eye(n)];
prob_struct.bineq = zeros (n, 1);
% Specify which solver to use
prob_struct.solver = & # 39; intlinprog & # 39 ;;
prob_struct.options = optimoptions (& # 39; intlinprog & # 39;);
%To solve the Problem
[X,Y] = intlinprog (prob_struct);
```