I've just started using Python and have run into a challenge that I think should be straightforward but i can't seem to figure it out. In Excel there is a Goal Seek option where you can optimize a value by changing another value. I'm wondering if a similar optimization problem can be solved efficiently in Python, but with the ability to chaneg multiple values at once.
A minimal example :
I have two arrays
x = np.array([2, 3, 5, 6, 2, 2]) y = np.array([3, 2, 1, 4, 4, 2]) I'm trying to find the values in y that will set the result of the below formula to 5 using only values [1, 2, 3]/
np.sqrt(sum((x-y)**2)) I know the correct values should be :
[1, 1, 2, 3, 1, 1] I realize there may be multiple solutions so being able to set some constraints around this would be good.
Are there any particular packages that would allow me to do this ? The above is just a toy example and in this case I could just try all possilbe combinations of [1, 2, 3] but I'm really looking for something that would scale to much bigger datasets.