I'm trying to run an optimization with scipy.optimize.differential_evolution. The code calls for bounds for each variable in x. But I want to a solution where parts of x must be integers, while others can range freely as floats. The relevant part of my code looks like
bounds = [(0,3),(0,3),(0,3),???,???]
result = differential_evolution(func, bounds)
What do I replace the ???'s with to force those variables to be ints in a given range?
scipy.optimize
support such a constraint. pyevolve and DEAP are two other Python libraries for building genetic algorithms which offer control over your mutation function such that you could constrain some or all of the elements in your solution vectors to be integers. Depending on the nature of your problem you might also take a look at integer programming libraries such as cvxpy or PuLP. – Antonio