I need to build an algorithm which will:
For 116 existing observations of 2 variables x1
and x2
(plotted individually: one single point)
- Create new observations by merging extreme points of 2 existing observations (ex: observation 117 will have 2 extreme points, (
x1_115
,x2_115
) and (x1_30
,x2_30
)). Do this for all combinations. If, for one combination, one pair dominates the other:x1_a
<x1_b
ANDx2_a
<x2_b
, only selecta
. - For the new set of 116+n newly created variables, remove the dominated pairs, in the same logic as above.
- Continue until we cannot create new non-dominated pairs.
I'm trying to solve this problem by creating independent functions for each operation. So far I have created the ConvexUnion function which merges extreme points (simply the union of 2 observations), but it does not take into account dominance yet.
ConvexUnion <- function(a,b){
output = NULL
for (i in 1:ncol(a)) {
u = unique(rbind(a[,i],b[,i]), incomparables = FALSE)
output = cbind(output, u)
}
output #the extreme points of the newly created pair
}
a = matrix(c(50,70), ncol = 2)
b = matrix(c(60,85), ncol = 2)
v = ConvexUnion(a,b)
TRAFO LABOR DELLV CLIENTS
1 49 15023 180119 11828
2 54 3118 212988 13465
3 31 6016 81597 4787
4 39 8909 127263 10291
5 9 1789 30095 2205
6 59 8327 190405 12045
7 95 11985 288146 16379
8 54 11309 208009 12252
9 13 3844 53631 4426
10 148 26348 459371 39831
11 17 3968 48798 3210
12 157 20131 366409 27050
13 18 4614 60366 4673
14 17 5941 49042 3950
15 77 6449 226815 12584
Here, the result for the new pair, which is the so-called convex union of a and b, would be (50,70) because a dominates b (both x1
and x2
are smaller).
How do I solve the problem?