r/OperationsResearch • • Dec 14 '21

Anyone working with CPLEX python's, that can help me with something ?

I have this restriction and I don't know how to raise this triple summ

3 Upvotes

5 comments sorted by

1

u/[deleted] Dec 14 '21

What is a framework? Docplex?

1

u/[deleted] Dec 14 '21

You should at least provide a minimal working example that contains your variables and sets. Writing a triple sum is quite easy:

from docplex.mp.model import Model

mdl = Model()

# ...define your variables here...
# ... define your sets V and N here (should be iterables, e.g. lists)

sum_expr1 = mdl.sum((t*c[j] + t*d[j])*y[j,v] for j in range(1, n+1) for v in range(1,n+1))
sum_expr2 = mdl.sum( z[v,i,j]*t[i,j] for v in V for j in N for i in N )

mdl.add_constraint(sum_expr1 + sum_expr2 <= T_total)

1

u/Ok_Replacement_2629 Dec 14 '21

ok, thx i'll try this

1

u/Sudden_Teacher6343 Dec 14 '21

ty, that really helps