- 于 R与并行计算今天用R的并行计算小试牛刀,单次循环时间降低了1/2,赞博主
初用R,遇到这样的一个问题,还请各位大侠指教
回复 第2楼 的 RemembeR discoveR, invent:If I would like the objective remain the same ,what function or package can be applied to this kind of optimization problem? much thanks
> param_init=c(t(par$beta),par$sigma,t(par$sigmab),par$corr)
>
> if (indcor==1)
+ {
+ param_min=c(-100,-100,-100,-100,-100,-100,0.05,0.05,0.05,0.05,0.05,-1)
+ param_max=c(100, 100 ,100, 100, -1, 5 ,1000 ,1000 ,1000 ,1000 ,1000, 1)
+ }
> if (indcor==0)
+ {
+ param_min = c(-100, -100, -100, -100 ,-100 ,-100 ,0.05,0.05 ,0.05 ,0.05 ,0.05 ,par$corr)
+ param_max = c(100 ,100,100,100,-1,5,1000,1000,1000,1000,1000,par$corr)
+ }
>
> # the algorithm should satisfy A*X<=B
> R=optimize(Qinv,lower=param_min,upper=param_max,maximum=FALSE,tol=0.0001,D=D,ran=ran,freq=freq)
错误于solve.default(cov, ...) : 系统计算上是奇异的: 倒条件数=0
>
由于对R还不太熟悉,还请各位大侠指教看了很多R优化包函数,其中的目标方程的输入参数都只包含自变量X。如果目标函数的形式很复杂,且需要在目标函数中设置一些常量输入, 有什么现成的优化包可以实现么