fcampelo / MOEADr

R package MOEADr, a modular implementation of the Multiobjective Evolutionary Algorithm with Decomposition (MOEA/D) framework
20 stars 7 forks source link

Fix decomposition_uniform [PRIORITY] #34

Closed fcampelo closed 7 years ago

fcampelo commented 7 years ago

Integration tests detected a problem with decomposition_uniform() that must be fixed.

Recall that all decomposition methods must return an [N x m] weight matrix W with all rows summing to unity.

Assume that decomp is defined as:

decomp <- list(name = "uniform", N = 10, .nobj = 2)

Running decomposition_uniform(decomp) yields:

> decomposition_uniform(decomp)
     Var1   Var2     Var3       Var4         Var5         Var6         Var7         Var8
[1,] 0.95 0.0425 0.005625 0.00121875 0.0003609375 0.0001328906 5.684766e-05 2.639355e-05
            Var9        Var10      VarLast
[1,] 1.18771e-05 3.365178e-06 6.393839e-05

A single vector (instead of the expected [10 x 2] matrix).

This problem appears not to happen for .nobj > 2. For instance, if we have 3 objectives:

> decomp$.nobj <- 3
> decomposition_uniform(decomp)
            Var1       Var2    VarLast
 [1,] 0.77639320 0.16770510 0.05590170
 [2,] 0.61270167 0.17428425 0.21301408
 [3,] 0.50000000 0.07500000 0.42500000
 [4,] 0.40839202 0.50286678 0.08874120
 [5,] 0.32917961 0.36895122 0.30186918
 [6,] 0.25838015 0.18540496 0.55621489
 [7,] 0.19377423 0.76591449 0.04031129
 [8,] 0.13397460 0.56291651 0.30310889
 [9,] 0.07804555 0.32268406 0.59927039
[10,] 0.02532057 0.04873397 0.92594546
> rowSums(decomposition_uniform(decomp))
 [1] 1 1 1 1 1 1 1 1 1 1

@caranha , since you implemented this routine, could you please look into it? I have temporarily removed decomposition_uniform() from the @exports list, until we can sort it out.

caranha commented 7 years ago

Done, see PR #35

fcampelo commented 7 years ago

Fantastic! Thanks! :)