I have a simple assignment problem. I have four tasks that can be assigned to two persons. It is possible that not every task is assigned to a person due to capacity limitations.
Each task requires: $$\begin{aligned} task 1: &200 \\ task 2: &500 \\ task 3: &300 \\ \end{aligned}$$
The capacity of each person is: $$\begin{aligned} person 1: &500 \\ person 2: &600 \\ \end{aligned}$$ Note: the numbers have no special meaning.
Consider the following primal LP problem: $$\begin{align} \text{maximize } & x_{11} + x_{12} + x_{21} + x_{22} + x_{31} + x_{32} + x_{41} + x_{42} \\ s.t. & x_{11} + x_{12} \leq 1 \\ & x_{21} + x_{22} \leq 1 \\ & x_{31} + x_{32} \leq 1 \\ & x_{41} + x_{42} \leq 1 \\ & 200x_{11} + 500x_{21} + 300x_{31} + 700x_{41} \leq 500 \\ & 200x_{12} + 500x_{22} + 300x_{32} + 700x_{42} \leq 600 \\ \end{align}$$ The objective is to maximize the number of assigned tasks. The decision variables are formatted $x_{ij}$ and indicate an assignment of task $i$ to person $j$. $x_{ij}$ is binary, i.e. $x_{ij} \in \{0,1\}$. The first three inequalities ensure that a task is assigned at most once and the last two inequalities ensure that a person's capacity is not exceeded.
Solving the primal LP results in (with GLPK): $$ x_{11} = 0\\ x_{12} = 1\\ x_{21} = 1\\ x_{22} = 0\\ x_{31} = 0\\ x_{32} = 1\\ x_{41} = 0\\ x_{42} = 0\\ $$ The objective value is 3. Obviously task 4 cannot be scheduled since the maximum capacity available is 600, i.e. $600 < 700$ required.
The dual is as follows: $$\begin{align} \text{minimize } & y_1 + y_2 + y_3 + y_4 + 500y_5 + 600y_6 \\ s.t. & y_1 + 200y_5 \geq 1 \\ & y_1 + 200y_6 \geq 1 \\ & y_2 + 500y_5 \geq 1 \\ & y_2 + 500y_6 \geq 1 \\ & y_3 + 300y_5 \geq 1 \\ & y_3 + 300y_6 \geq 1 \\ & y_4 + 700y_5 \geq 1 \\ & y_4 + 700y_6 \geq 1 \\ & y_1, \cdots ,y_6 \geq 0 \\ \end{align}$$
Solving the dual LP yields (again with GLPK): $$ y_1 = 1\\ y_2 = 1\\ y_3 = 1\\ y_4 = 1\\ y_5 = 0\\ y_6 = 0\\ $$ The objective value is 4.
I know the dual's objective value is still an upper bound to the primal problem. However, I suspected the dual's optimal value to be equal to the primal's optimal value. I haven't been able to fully understand why this is happening, can someone clarify? Did I made a mistake somewhere?
An integer program does not have a standard dual problem---only its LP relaxation does. The LP relaxation of a binary program is obtained by replacing the constraints $x_{ij}\in\{0,1\}$ with $0 \leq x_{ij} \leq 1$. Solving the dual problem with binary constraints, which you have apparently done, has no useful interpretation.
If you solve both the primal relaxed problem and its dual, you will see they obtain the same optimal value of 3.14286. The optimal value of $x$ is the same as in the binary case, except that $x_{42}=0.14286$. The dual variables are all fractional, except for $y_4$, which is zero. This makes sense, because its corresponding constraint is inactive; that is, $x_{41}+x_{42}<1$.
(EDIT: The dual problem you have cited is slightly different than the one you typically get if you mechanically relax a binary LP. Yours is the dual that arises if you replace $x_{ij}\in\{0,1\}$ with nothing; that is, if you just drop the binary requirement altogether. In this case, it happens to "work" because the other constraints happen to enforce $x_{ij}\in[0,1]$ implicitly. It's a minor point, really; doing it the "mechanical" way would just add some redundant dual variables in this case.)