I have a linear function for two input value according the following (params
has been computed already):
def objective(x):
return x[0] * params[0] + x[1] * params[1] + params[2]
Now I want to calculate the optimum (minimum) of the function with scipy.optimize.minimize
with restrictions on the input value ranges: the sum of the inputs are not allowed to be greater than 1000. I can restrict the respective two input to ranges:
bounds = ((0.0, 1000.0), (0, 1000.0))
scipy.optimize.minimize(objective, (0, 0), method="TNC", bounds=bounds)
and it gives 1000, 1000
as candidates for the input values for the optimum, as expected. However, as I stated, I need the input value pair for optimum in the range where the sum of the values is restricted, not only the separate input values independently. How should I modify my code in order to do that?