I need the outputs to sum up to a certain number. I followed the docs but the output now go nuts, using the following:
def constraint_func(x):
return target_sum -np.sum(x)
target_sum = h_prof['Quantity'].sum()
constraint = {'type': 'eq', 'fun': constraint_func}
result = opt.minimize(func, IH, args = (h_prof['Quantity'], Matrix, Prices['HP']), constraints=constraint)
How can I get the output: ‘result.x’ to sum up to a certain number?