Expr = L – c’ *x # define a expression
Con[0] = Expr[0] / d[0] * d[0]
Con[k] = (Expr[k] *d[k] + Expr[k-1]) / d[k] for k in 1 to 7 (use a loop to extend that expression)
Constraint => y >= Con[k] for k in 0 to 7
where L, c, d are data , and x and y are optimization variables defined in this package as shown in Python code below.
Can anyone please help me to code this constraint? My attempts at trying to implement this is shown at the bottom.
--
You received this message because you are subscribed to the Google Groups "Python-MIP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mip+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-mip/e62a046a-51f9-4d63-8091-f5590d9ee556n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Python-MIP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mip+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-mip/051312ea-d3cd-4652-8424-03f19cb8b2c8n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-mip/1455f994-ddd5-4420-a227-f2e3fb1c2d02n%40googlegroups.com.
Thanks for you help
for i, sub in enumerate(c):
m.add_constr(xsum((L[j]- j * x[i])/d[j] for j in range(len(sub))) <= y)
This does not do what I want from the constraint. My constraint is cumulative in the sense that the expression at the previous period gets added to the following period.I will just give up on this.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-mip/c0ae1f9c-78a2-49c9-b45d-f6df8a2286b8n%40googlegroups.com.