Is there tools for optimization in python, where I can choose target value for function and get best parameters, that will be integers?
Example, my function is:
f(x) = 4*A + B
So If choose 5 as a target value it will return me A=1 and B=1
Is there tools for optimization in python, where I can choose target value for function and get best parameters, that will be integers?
Example, my function is:
f(x) = 4*A + B
So If choose 5 as a target value it will return me A=1 and B=1
Maybe a constraint solver:
# https://pypi.org/project/python-constraint/
from constraint import *
problem = Problem()
problem.addVariables(["a","b"],range(1,100000))
problem.addConstraint(ExactSumConstraint(5,[4,1]))
problem.getSolutions()
This gives:
[{'a': 1, 'b': 1}]