fcampelo / MOEADr

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

decomposition_sld generates array with useless row numbers #1

Closed caranha closed 7 years ago

caranha commented 7 years ago

Not sure if this is a problem or not, but the row names of the weight array returned by decomposition_sld is meaningless (side effect of rbind, probably).

You can fix this with rownames(X) <- NULL if necessary

Example

% p <- list(H=4,.nobj=3) % decomposition_sld(p)

Var1 Var2 VarLast 1 0.00 0.00 1.00 2 0.25 0.00 0.75 3 0.50 0.00 0.50 4 0.75 0.00 0.25 5 1.00 0.00 0.00 6 0.00 0.25 0.75 7 0.25 0.25 0.50 8 0.50 0.25 0.25 9 0.75 0.25 0.00 11 0.00 0.50 0.50 12 0.25 0.50 0.25 13 0.50 0.50 0.00 16 0.00 0.75 0.25 17 0.25 0.75 0.00 21 0.00 1.00 0.00

fcampelo commented 7 years ago

{Var1 ... VarN} is a side effect of expand.grid, but is completely harmless in this case. Not sure if it's worth the effort of removing the names.

The name of the last column (VarLast) is used to filter the valid weight vectors.

caranha commented 7 years ago

Just to make sure: I'm talking about row names, not column names.

fcampelo commented 7 years ago

I misread, my bad. All the same, I think there is no harm in having the (spurious) row names. Not sure if making rownames(X) <- NULL would improve processing time, or even save much memory. What do you think?

caranha commented 7 years ago

Well, it looks weird, and the fix is a single line. It's not so much about saving processing time, it is more about making things tidy.

That said, I don't really have a strong opinion on it, else it this would be a bug report :-)

fcampelo commented 7 years ago

Tidy is good in my book. :-) Please go ahead and add the rownames(X) <- NULL line in your next commit. :-)

caranha commented 7 years ago

Okie dokie