Displaying 1 result from an estimated 1 matches for "inequal1".
Did you mean:
inequal
2011 Dec 12
0
Rsolnp package: warning messages
..._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 limit for inequalities
ineqLB=rep(0.00001,BR)
#the upper limit for the inequalities
ineqUB=rep(1.00001,BR)
# the lower and upper bounds for the variables
LB=rep(0,CELL)
UB=rep(1,CELL)
#the seed for varia...