constrOptim in R - init val is not in the interior of the feasible region error

末鹿安然 提交于 2019-11-28 14:25:27
42-

If you search Google you get an answer from @HongOoi in the comments of another question with a similar error message. Hong Ooi suggested subtracting a fuzz value from the ci argument:

  fuzz = - 1e-6


 constrOptim(rep(1/3,3), f=test_func,grad = NULL,
             ui = rbind(diag(3),rep(1, 3), rep(-1,3)),
             ci = c(rep(0,3),1,-1)- 1e-6, method = "Nelder-Mead")
#---------------------
$par
[1] 0.3333317 0.3333327 0.3333346

$value
[1] 0.3333327

$counts
[1] 0

$convergence
[1] 0

$message
NULL

$outer.iterations
[1] 1

$barrier.value
[1] 0.000209865

I think this is probably an issue that might warrant sending a request to the R-devel mailing list for documentation improvement, although arguable you are not actually in the interior of the feasible range since the constraint tes fails a strict inequality:

 ui %*% rep(1/3,3) - ci > 0
      [,1]
[1,]  TRUE
[2,]  TRUE
[3,]  TRUE
[4,] FALSE
[5,] FALSE

Your first three constraints were satisfied by the inequality but not the last two which were on the boundary.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!