1

I'm trying to solve an order minimization problem with python. Therefore I distribute M orders over N workers. Every worker has a basic energy-level X_i which is gathered in the vector X. Also, every order has a specific energy consumption E_j which is gathered in E. With that being said I'm trying to solve the following problem

enter image description here

where Y is some optimal energy level, with the norm beeing the 2-norm. Under the constraints, that any column adds up to exactly one, since an order should be done and could only be done by one worker. I looked at scipy.optimize but it doesn't seem to support this sort of optimization as far as I can tell.

Does one know any tools in Python for this sort of discrete optimization problem?

mike
  • 13
  • 3

1 Answers1

2

The answer depends on the norm. If you want the 2-norm, this is a MIQP (Mixed Integer Quadratic Programming) problem. It is convex, so there are quite a number of solvers around (e.g. Cplex, Gurobi, Xpress -- these are commercial solvers). It can also be handled by an MINLP solver such as BonMin (open source). Some modeling tools that can help are Pyomo and CVXPY.

If you want the 1-norm, this can be formulated as a linear MIP (Mixed Integer Programming) model. There are quite a few MIP solvers such as Cplex, Gurobi, Xpress (commercial) and CBC, GLPK (open source). Some modeling tools are Pyomo, CVXPY, and PuLP.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
  • Is there a way to model minimization problems over discrete matrices in Pyomo or CVXPY? I've been gathering some information, but did not find out how to minimize over matrices yet. – mike Apr 21 '20 at 15:05
  • Yes. Both allow MIQP and MIP models to be expressed. CVXPY allows direct matrix notation. In Pyomo just use indexed variables. – Erwin Kalvelagen Apr 21 '20 at 15:19
  • Do you know how i can create a discrete variable in CVXPY? The documentation doesn't tell anything about it and i did not find an answer to this question yet. – mike Apr 28 '20 at 14:43
  • `x = cp.Variable(10, boolean=True)` and `Z = cp.Variable((5, 7), integer=True)` (from the documentation) – Erwin Kalvelagen Apr 28 '20 at 15:34