search for: equal1

Displaying 1 result from an estimated 1 matches for "equal1".

Did you mean: equal
2011 Dec 12
0
Rsolnp package: warning messages
...p) # the objective function to maximize #NOTE: by default the solver minimizes the objective. therefore the original minus sign is not used obj=function(x){ all1=sum(mat%*%x) Hp=0 for (j in 1:BR){ p_b=mat[j,]%*%x/all1 Hp=Hp+p_b*log(p_b)*br[j] } return(Hp) } # the equality constraint function: equal1=function(x){ all2=sum(mat%*%x) sum_pterm=sum(mat[1:N,]%*%x/all2) sum_x=sum(x) return(c(sum_pterm,sum_x)) } # the right hand side for the constraint eqB=c(1,budget) # the inequality function inequal1=function(x){ all3=sum(mat%*%x) p_b=mat[1:BR,]%*%x/all3 return(as.vector(p_b)) } #the lower lim...