我有一个函数可以绘制其约束
sum=0
obj_fn <- function(x){
for(i in 1:nrow(ldata)){
for(j in 1:4){
sum=sum+ldata[i,j]*x[j]*x[5]*d_km
}
}
return(-sum)
}
约束是
constraint1<-function(x){
h <- numeric(5)
h[1] <- x[6]*x[1]-x[2] # r2>=fact*r1
h[2] <- x[6]*x[2]-x[3] # r3>=fact*r2
h[3] <- x[6]*x[3]-x[4] # r4>=fact*r3
#h[4] <- x[5]-1 # z<=1
h[4] <-(-obj_fn(x) )-A1 # A2=A1
h[5] <- A1-(-obj_fn(x) )
#h[6] <- 1.5-x[6] #fact>=1.5 here x[6] is the factor
return(h)
}
如何绘制它,因为它是一个巨大的功能。谁能帮我这个忙。基本上需要制作3D或等高线图