Solved – Python library for combinatorial optimization

combinatoricsoptimization

I've been recently working with a combinatorial optimization problem defined as follows. Given two sets of items, A and B, select the best combination of these items given a scoring function $f(A,B) \rightarrow \mathbb{R}$. The goal is to maximize the output.

As I am new to this field, my initial impression was, to try and code up a stochastic optimizer, such as for example genetic algorithm to solve this. My question is, are there any libraries apart from $\textit{Deap}$, which offer such functionality.

Thank you.

Best Answer

The problem you are trying to solve is a variant of the two-way partitioning problem (pg. 234/730 in the pdf http://web.stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf) which is known to be NP hard.

What this means in layman terms is that if the size of A and B is large, the problem can basically not be solved exactly. At best, one can hope to get algorithms which say statements of the form "We are off by a factor of at most k".

In these cases, the details become important. I would recommend you not code up such algorithms yourself, because they will likely be very inefficient (and maybe even way off!).

The library is not the issue here; the functional form of $f$ can dramatically change the approach

Related Question