R에서 lpSolve를 사용하고 있습니다. 내 모델 (데이터 포락 분석)이 MAC에서 잘 실행되지만 UNIX 클러스터에서 실행하려고 시도 할 때 많은 모델이 퇴화되는 것으로 밝혀졌습니다. lp.control 옵션은 두 시스템에서 동일합니다. 나는 presolve 및 anti.degen 옵션을 사용하여 퇴행 횟수를 줄이지 만 줄일 수있었습니다.lpSolve를 사용할 때의 세대 축소
동일한 선형 프로그래밍 모델을 해결하기 위해 미리 빌드 된 R 패키지 (벤치마킹, nonparaeff)를 사용할 때 똑같은 문제가 발생한다는 점에 유의하십시오.
누가 유닉스 클러스터의 왜곡 오류를 아는 사람이 있습니까?
건배,
사람이 다음과 같이 코드가 관심이 있다면
피터. 기본적으로 300 개의 에이전트 각각에 대해 선형 프로그래밍 모델을 생성하고이 문제를 해결합니다. 내 Mac에서 모든 문제가 잘 해결되지만, 클러스터에있는 문제의 90 %는 퇴화로 발견된다 : 당신이 (매우 본래 크기의 타락이다 (300) 작은 문제를 해결하는 것 같은
library(lpSolveAPI)
set.seed(198302)
##############Create data
x=matrix(rnorm(1200,5,3),300,4)
y1=x%*%c(.4,.2,.7,.8)+rnorm(300,4,.5)
y2=x%*%c(.5,.8,.2,.3)+rnorm(300,4,.5)
y=cbind(y1,y2)
##############Write DEA function
xref=x
yref=y
##Define dimensions
mx<-ncol(xref)
my<-ncol(yref)
nref<-nrow(xref)
nobs<-nrow(x)
##Define empty matrices for efficiency scores, lambdas and slacks
eff<-rep(0,nobs)
lambda<-matrix(0,nobs,nref)
slacks<-matrix(0,nobs,mx)
##Start the model, noting that there will be as many constraints as there are inputs, outputs and one additional constraint on lambda. And as many decision variables as there are producers (lambdas) + one (efficiency score)
deamodel<-make.lp(nrow=mx+my+1,ncol=nref+1)
## For each input and output set the row as a constraint
for (h in 1:mx) set.row(deamodel, h, c(0, -xref[, h]))
for (h in 1:my) set.row(deamodel, mx + h, c(0, yref[, h]))
##Set a single objective function
set.objfn(deamodel, 1, 1)
##Set the type of constraints. Inputs and outputs are all greater than, lambdas is equal to
set.constr.type(deamodel, c(rep(">=", mx + my),"="))
##Set another row as a constraint on lambdas
set.row(deamodel, (mx+my+1), c(0,rep(1,nref)))
set.rhs(deamodel, 1, mx+my+1)
##In a loop create a lp model for each producer
for (k in 1:nobs){
##Set the right hand side equal to output of the individual producer
set.rhs(deamodel, c(rep(0,mx), y[k, ]), 1:(mx + my))
##Set first column equal to input of producer
set.column(deamodel, 1, c(1,x[k,]), 0:mx)
##Set some presolve options
lp.control(deamodel, presolve=c("rows", "columns","rowdominate","coldominate","bounds"))
##Solve the model
a=solve(deamodel)
if (a==0){
eff[k]<-get.objective(deamodel)
lambda[k,]<-get.variables(deamodel)[-1]
slacks[k,]<-get.constraints(deamodel)[1:mx]}
if (a!=0){
eff[k]<-NA
lambda[k,]<-NA
slacks[k,]<-NA
}}
eff
아마도 당신은 당신의 Mac과 더 개인적인 관계가 있으며 단지 당신을 더 사랑한다는 것입니까? –
관련 항목 : http://stackoverflow.com/questions/13447373/set-seed-in-mac-vs-windows – flodel