I have a function to plot along with its constraints
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)
}
Constraints are
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)
}
How can I plot as it is a huge function. Can anyone help me in this. Basically a 3D or a cotour plot is required to be produced