I want to minimize a function (rmse) in R just like solver does in excel. Using the constrained vaiables (i) and conditioning it for
**i >= 0 && i<=2**
ac = c(85,95,79,88,90,99,111,99,100,110)
ff = c(100,110,105,95,115,105,110,120,105,110)
ff1 = ff[2:5] ;ac1 = ac[2:5]
i=1.1 #Assume-Constraint variable
revff = ff1*i
dev1 = abs(ac1-revff)
rmse_function = function(ac1,ff1,i) sqrt(sum(abs(ac1-ff1*i)^2))
I want to minimize the function rmse by changing the variable i.