Originally posted by: SystemAdmin
The constraint I wrote in opl is like this:
(sum(i in 1..NCOL) x[i] * edv[i]) - 0.166 * (sum(i in 1..NCOL) x[i] * edn[i]) <= 0;
the code below is what I trying to do in python, It does't work.
when i =0 the edvalue *assignvars = 0 * 'x0'='', I don't know if this '' would be recognized as the correct to add the constraint.
>>> ednumber
0:10 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 >>> edvalue
0:10 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 >>> assignvars
0:10 for i in range(NCol):
thevars=[]
thevars.append(edvalue[i]*assignvars[i])
thecoef=
http://-0.166 thevars.append(assignvars[i]*ednumber[i])
thecoef.append(1)
lin_values =
http://cplex.SparsePair(thevars,thecoef) vrp.linear_constraints.add(lin_expr = lin_values, senses = , rhs = [0])
#CPLEXOptimizers#DecisionOptimization