I have little background in mathematics and am trying to write a multi-objective optimization function.
I have the following 3 vectors:
A = 0.4122487 0.3861316 0.3160613 0.2949684
B = 0.1407469 0.1828053 0.2088941 0.2143583
C = 0.2966363 0.1947112 0.1664350 0.1543946
My goal is the following: to find at which value X my requirements are best met: 1) minimize A, 2) maximize B and 3) maximize C.
Here is my code:
fun <- function(weights,A,B,C){
fit = sum((weights[1] * A +
weights[2] * B +
weights[3] * C))
return(fit)
}
# the weight of A (positive, since I want to minimise A)
Wa = 1
# the weight of B (negative, since I want to maximise B)
Wb = -0.5
# the weight of C (negative, since I want to maximise C)
Wc = -1.5
result <- optim(weights=c(Wa,Wb,Wc), fn = fun)
Here are the results:
result$par = 2.365022e+44 -1.697108e+44 -9.150244e+43
result$value = -5.343856e+44
Is my implementation correct? How do I interpret these results? My understanding is very limited, but instinctively these numbers seem out of proportion compared to the range of my initial vectors...