[ad_1]
I am trying to fill in a vector (xt) by using a nested loop. The vector elements are based on the elements of a matrix (dmu.dat). Here is my code:
for (i in 1:no_of_dmu)
xt <- c()
for (j in 1:no_out_in)xt[j] = dmu.dat[i,j]
add.constraint(dmu.lp, xt, type = "<=", rhs = 0)
The function add.constraint() is part of the lpSolveAPI package. For some reason I get this error:
Error in add.constraint(dmu.lp, xt, type = "<=", rhs = 0) :
the length of ‘xt’ is not equal to the number of decision variables in the model
Can anyone help me with this? Much appreciated.
[ad_2]
لینک منبع