Skip to content
Prev 374458 / 398513 Next

adding overall constraint in optim()

Hi,

You can use the projectLinear argument in BB::spg to optimize with linear equality/inequality constraints.



Here is how you implement the constraint that all parameters sum to 1.



require(BB)

spg(par=p0, fn=myFn, project="projectLinear", projectArgs=list(A=matrix(1, 1, length(p0)), b=1, meq=1))



Hope this is helpful,

Ravi