# [R] Optimization problem

José E. Lozano lozalojo at jcyl.es
Thu Jun 17 13:48:12 CEST 2010

```Hello,

I'm facing a problem of optimization, I've already solved but I'm trying to
find other answers to this problem to improve the solution.

Well, to make it short: I have to set/install a number of devices in a
building, and I have to give service to a number of "customers", or better
say, to give a good quality of the signal. The more devices I place, the
higher the signal. The signal is measured in a (coverage) percentage, the
higher the percentage, the better the service. The max percentage is
(obviously) 100%.

As an example:

Example 1:
----------
devices<-1:49
percentages<-c(15.8,29.3,43.1,52.9,61.8,70.4,77.6,84.4,88.6,90.9,92.7,93.2,9
4.1,94.6,95.4,96.1,96.5,97,97.3,97.8,98.1,98.7,99,99.4,99.5,99.6,99.7,99.9,1
00,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,1
00,100)
matplot(devices,percentages,type="l")
cbind(devices,percentages)

In this example, I can place up to 49 devices, though it does not make any
sense to place more than 29 since 29 devices gives a quality of 100%, the
maximum.

My problem is that I want to minimize the number of devices maximizing the
percentage.

I think the key is "I don't want to add a new device if there is no
significance change in the final percentage", so looking at the graph 11
devices seems logical. Notice that my objective is not the final percentage,
it can be 90%... or 50%. The service is ok with both numbers.

Although I've solved the problem calculating the slope and making an axis
change, I'd like to make something "statistically" stronger, because in the
end what I'm doing is making some trigonometrics.

If you think on other solutions i'd appreciate your help.

Thanks,
J. Lozano

Other examples:

Example 2:
----------
devices<-1:45
percentages<-c(19.6,38.3,53.2,65,72.9,78.5,82.8,87,89,90.1,91.7,92.6,93.7,94
.6,95.4,96,96.5,96.9,97.2,97.7,97.9,98.3,98.6,98.8,99,99.3,99.6,99.8,100,100
,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100)
matplot(devices,percentages,type="l")
cbind(devices,percentages)

45 total devices, 9-10 devices seem logical.

Example 3:
----------
devices<-1:37
percentages<-c(12.4,24.6,35.8,44.9,53.4,61.6,70,76.9,82.3,84.7,87.5,89.1,90.
7,91.8,92.9,94.3,95.6,95.9,97,97.2,97.4,97.8,98,98.2,98.4,98.7,99,99.2,99.4,
99.6,99.8,100,100,100,100,100,100)
matplot(devices,percentages,type="l")
cbind(devices,percentages)

37 total devices, 9 devices seem logical.

Example 4:
----------
devices<-1:52
percentages<-c(12.2,22.4,32,41.3,50.1,56.2,61,64.3,66.9,69.2,73.7,76,78.6,81
.7,85.4,87.8,91.1,92.8,94.2,95,95.6,96.3,96.6,97.3,97.7,98.2,98.5,98.7,99.2,
99.6,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100
,100,100,100,100)
matplot(devices,percentages,type="l")
cbind(devices,percentages)

52 total devices, hard to chose, 9? 19?

```