Quantcast
Channel: Yet Another Math Programming Consultant
Viewing all articles
Browse latest Browse all 809

Variant of an Assignment Problem

$
0
0
The standard assignment problem can be stated as:

\[\begin{align}\min\>&\sum_{i,j} c_{i,j} x_{i,j}\\ & \sum_j x_{i,j} = 1 && \forall i\\ & \sum_i x_{i,j} = 1 && \forall j\\&x_{i,j} \in \{0,1\} \end{align}\]

There are highly efficient specialized algorithms for this problem [1]. I often solve these problems just as an LP (the integer variables are automatically integer valued for this particular problem). That sounds like a dumb approach, but there are some reasons:

  • LP solvers are actually very good in solving this quickly (often faster than a specialized method that is not implemented with very much care for efficiency [2]).
  • Variants and extensions are (often) easily handled.

The standard model above assumes the sets \(i \in I\) (sources) and \(j \in J\) (destinations) have the same size. Now assume we have more \(j\)'s than \(i\)'s. The model can be updated to:

\[\begin{align}\min\>&\sum_{i,j} c_{i,j} x_{i,j}\\ & \sum_j x_{i,j} = 1 && \forall i\\ & \sum_i x_{i,j} \le 1 && \forall j\\&x_{i,j} \in \{0,1\} \end{align}\]

I.e. each \(i\) is connected to a unique \(j\), but some \(j\)'s are not assigned. A solution can look like:


----     41 PARAMETER c  cost coefficients

j1 j2 j3 j4 j5 j6 j7 j8 j9 j10

i1 0.6610.7560.6270.2840.0860.1030.6410.5450.0320.792
i2 0.0730.1760.5260.7500.1780.0340.5850.6210.3890.359
i3 0.2430.2460.1310.9330.3800.7830.3000.1250.7490.069
i4 0.2020.0050.2700.5000.1510.1740.3310.3170.3220.964
i5 0.9940.3700.3730.7720.3970.9130.1200.7350.0550.576


---- 41 VARIABLE x.L assignment variables

j2 j5 j6 j9 j10

i1 1
i2 1
i3 1
i4 1
i5 1


Original assignment and new variant


In [3] an unusual variant is asked for: the assigned \(j\)'s should be adjacent. The required configuration can be seen in the right picture above.

The first thing we do is to keep track if a \(j\) node is assigned. For this we introduce new binary variables \(y_j\) and replace the second assignment constraint \(\sum_i x_{i,j} \le 1\) by:

\[\begin{align} &y_j = \sum_i x_{i,j}\\&y_j \in \{0,1\}\end{align}\]

The variable \(y_j\) will be zero for the unassigned nodes (grey in the picture above), and one if connected (red). We can force we don't have "holes" in the \(y\) vector by requiring that we see the pattern \([0,\> 1]\)  only once. This we can model as:

\[\begin{align} &z_j \ge y_j - y_{j-1}\\& \sum_j z_j \le 1\\&z_j \in \{0,1\} \end{align}\]

This approach is often used in machine scheduling or power generation: prevent a generator to be turned on too many times.

This model has as results:


----     44 VARIABLE x.L  assignment variables

j5 j6 j7 j8 j9

i1 1
i2 1
i3 1
i4 1
i5 1


---- 44 VARIABLE y.L destination is used

j5 1, j6 1, j7 1, j8 1, j9 1


---- 44 VARIABLE z.L 0-1 transition

j5 1

The complete GAMS model looks like:


Notes:

  • The variables \(y\) and \(z\) can be relaxed to be continuous between zero and one.
  • The \(x\) variables are no longer automatically integer valued. We need to solve this model as a real MIP and can not use just an LP solver.
  • When using leads and lags we always have to look at the boundary case. Here we have the special case \(z_1 \ge y_1 - 0\). In GAMS when we index out-of-domain we get a zero. That is exactly what we need in this case.


References


  1. Rainer Burkard,‎ Mauro Dell'Amico,‎ Silvano Martello, Assignment Problems, SIAM, 2009
  2. Assignment problem, http://yetanothermathprogrammingconsultant.blogspot.com/2009/11/assignment-problem.html
  3. Combinatorial optimization: assignment (matching) with “consecutive” assignments, https://stackoverflow.com/questions/48049506/combinatorial-optimization-assignment-matching-with-consecutive-assignments

Viewing all articles
Browse latest Browse all 809

Trending Articles