Решение задачи оптимизации портфеля с двумя ограничениями
#optimization #stock #r-portfolioanalytics Вопрос: total_amount <- 1000000 df <- data.frame("price"= c(226,186,456,615,549), "firms"= c("VRSN","TXN","DPZ","IDXX","ORLY")) FUN <- function(q, price=df$price){ total <- sum(price * q) errs <- c( (total-total_amount)^2, ( ( q[1]*price)/sum(q[1]*price q[2]*price…