Optimization, Python, Linear Optimization, Operations Research.
demand def const1(): tmp = [] for idx in range(0, cost2d.size, len(J)): tmp_constr = { 'type': 'eq', 'fun': lambda x, idx: d[idx//len(J) + 1] - np.sum(x[idx: idx + len(J)]), 'args': (idx,) } tmp.append(tmp_constr) return tmp # Constraints: sum of goods <= factory capacity def const2(): tmp = [] for