Python, Cvxpy, Optimization.
variables x = cp.Variable((n_warehouses, n_retailers), integer=True) # Define the objective (minimize cost) objective = cp.Minimize(cp.sum(cp.multiply(cost, x))) # Define the constraints constraints = [ cp.sum(x, axis=1) <= supply, # Supply constraints cp.sum(x, axis=0) == demand # Demand