Hello, I am a graduate student (in ecology, so not a great background in mathematics or coding languages) attempting an optimization for a part of my thesis. Currently I have the coding below in an attempt to get the "program" to work with pseudo-data. This has been constructed based on publications, which use other programming languages, but the functions are "...local minimizer for smooth non-linear functions subject to bound-constrained parameters, and uses a quasi-newton method". Thus I believe the correct call is NLPQN, however when running this I do not get the expected optimization. Proc IML; start qfasa(y); prey={17 41 5, 40 30 25}; /*pseudo-profile of three prey items with 2 variables each*/ predator={13.4, 29.5}; /*pseudo-profile of one predator with 2 variables that are the proportional addition of the prey items*/ predic=(prey#y); diet=predic[,+]; KL1=((predator-diet)#log10(predator/diet)); /*Kulback-Liebler Distance*/ KL=KL1[+,]; Return(KL); /*currently must be a scalar, possible to get this for each predator column when more are added? (do loops?)*/ finish qfasa; y={.5 .25 .25}; /* Initial guess at proportions*/ c={0 0 0, 1 1 1}; /*Constraints on parameters*/ optn={0 2}; call nlpqn(rc,xr,"qfasa",y,optn,c) ; run; */Answer should be { .25 .15 .60}*/ Thanks for any help!
... View more