fork download
  1. eval_f0 <- function(x){
  2. x[1] <- t(t(as.array(unlist(x[1]))))
  3. return(t(x[1])%*%x[1])
  4. }
  5.  
  6. eval_q0_1 <- function(x){
  7. return(c(-1*x[2],
  8. (trd %*% t(t(x[3]))-t(t(x[4]))%*%Price+x[1])-x[5],
  9. -1*x[5],
  10. x[2]-1))
  11. }
  12.  
  13. eval_q0_2 <- function(x){
  14. return(c(Market.Share-x[2],
  15. x[2]%*%(x[5]-(trd%*%x[3]-x[4]%*%Price+x[1])),
  16. x[5]%*%(1-x[2])))
  17. }
  18.  
  19. res1 <- nloptr( x0=list(rep(1, nrow(trd)), rep(1, nrow(trd)), rep(1, ncol(trd)), 1, rep(1, nrow(trd))),
  20. eval_f=eval_f0,
  21. lb = c(matrix(0, nrow = nrow(trd), ncol = 1),
  22. matrix(0, nrow = nrow(trd), ncol = 1),
  23. matrix(0, nrow = ncol(trd), ncol = 1),
  24. matrix(0, nrow = nrow(trd), ncol = 1),
  25. matrix(0, nrow = nrow(trd), ncol = 1)),
  26. ub = c(matrix(Inf, nrow = nrow(trd), ncol = 1),
  27. matrix(Inf, nrow = nrow(trd), ncol = 1),
  28. matrix(Inf, nrow = ncol(trd), ncol = 1),
  29. matrix(Inf, nrow = nrow(trd), ncol = 1),
  30. matrix(Inf, nrow = nrow(trd), ncol = 1)),
  31. eval_g_ineq = eval_q0_1,
  32. eval_g_eq = eval_q0_2,
  33. opts = list("algorithm"="NLOPT_LD_SLSQP")
  34. )
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class, interface, or enum expected
eval_f0 <- function(x){
^
1 error
stdout
Standard output is empty