全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
3339 1
2014-12-13
     大家能帮我解读一下这段代码么,在R中怎样实现这个优化。毕业论文要用这提到的方程和优化方法,但是却不知道怎样进行这个过程。模型是这样的
44.png
Appendix. Optimization procedure###(附件.优化过程)
# 1: main function (which is optimizedlater) ##(主函数(稍后优化))
function sub_optimization(input parameters:αi for each species i)(子优化函数(为每物种输入参数αi))
total_criterion_sum = 0
for each stand p{
  #definition of linear programming variables
Amatrix = matrix(ncol=number of species,nrow= number of
inventories in this plot)
  #vector corresponding to the sums of Amatrixcolumn
Initializing cvector #vectorsize: number of species
  #vector of constraints: all are equal to 1
bvector= [1,1 … 1] #vector size: number ofinventories
for each species i{
   for each date t{
11.png    }
   }
22.png

  #linear programming (through the R package “solveLP”)

LPresult = linear programming (inputparameters: Amatrix, bvector, cvector)

# computation ofthe criterion (as presentedin Equation 9) for this stand


33.png
# the criterion for all stands
total_criterion_sum = total_criterion_sum +criterion_stand
}
return(total_criterion_sum)
} #end of sub_optimization function
#2 : all.LPresult is optimized by amaximum-likelihood estimation. Outputs are αi
for each species i, constrained between 0and 3.
optim( sub_optimization, start = { αi=1.8} , lower=0, upper=3 )

#end of script


附件列表
33.png

原图尺寸 9.79 KB

33.png

33.png

原图尺寸 9.35 KB

33.png

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2015-1-19 15:17:20
稍微解释一下呗~
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群