Re: [R] constrained optimization help please!

2012-11-05 Thread hayduke
Thank-you Berend. This approach does work. Now I need to constrain the problem so that sum(d.NR) is positive for each fleet. I tried this but with no luck: *nfleets<-2 nareas<-2 M<-1 M<-array(M,dim=c(nfleets,nareas)) N<-1000 cost<-c(40,40) cost<-array(cost,dim=c(nfleets,nareas)) Price<-2 Price<-ar

[R] constrained optimization help please!

2012-11-01 Thread hayduke
Hi All, I am having some real difficulty in trying to carry out constrained optimization. I have had no problems with the Optim() function but when I try to constrain the problem I am getting all sorts of error messages. The model is a simple 2 area, 2 fleet, 1 stock model of a fishery. The code i

Re: [R] Penalty function constrained optimization

2012-10-17 Thread hayduke
Thanks Simon, the code worked very well. -- View this message in context: http://r.789695.n4.nabble.com/Penalty-function-constrained-optimization-tp4646383p4646490.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

[R] Penalty function constrained optimization

2012-10-16 Thread hayduke
Hi All, I am trying to use optim() to minimize a function with a penalty function term. This is a simple model bioeconomic model of a fishery. The penalty function constrains the amount of effort (f) at 9. This works fine. The code is: ** nfleets<-2 M<-1 M<-array(M,dim=c(nfleets)) N<-1000 c