0

I am trying to solve a assignment problem using linear programming. I am using the simplex algorithm mentioned in CLRS.

Consider the below example:


          --(1/1)--->|a|---(10/1)------>|d|----------->
         |            |                  ^            |
         |            |_(7/1)__          |            |
        |s|            ________|_(12/1)__|           |t|
         |            |        |_______               |
         |            |                |              |
         |            |                v              |
          --(1/1)--->|b|---(10/1)---->|c|--(1/1)----->

Vertex a and b are the persons.

Vertex c and d are the jobs.

I have modeled it as a min cost max flow problem.

Source S and Sink t has been added.

All the edge weights have been set to 1.

Edge cost from source to vertex a and b is set to 1.

Edge cost from d,c to sink is set to 1.

The (a/b) values in the edge represent (Cost/Flow Capacity) for that edge.

I use W to represent edge cost and C for capacity.


    The linear program is:
        Minimize,
             Summation(W(uv).f(uv)) over all uv.

    Such that,
         f(uv) >= 0 , for all (u,v) in E

         f(uv) <= C(u,v) , C(u,v)=1 in this case, for all (u,v) in E

         Flow conservation for each vertex except the source and the sink.
         So Sum(f(uv)) = Sum(f(vu)), for all u,v

         Flow demand of atleast 2, since we need to match 2 persons.
         f(sa) + f(sb) = 2


The Standard Form is:
    Maximize,
         -(Summation(W(uv).f(uv)) over all uv)

       Such that,
         f(uv) >= 0 , for all (u,v) in E

         f(uv) <= C(u,v) , C(u,v)=1 in this case, for all (u,v) in E

         Flow conservation for each vertex except the source and the sink.
         So Sum(f(uv)) = Sum(f(vu)), for all u,v

         Demand:
         f(sa) + f(sb) = 2


Which reduces to 
   maximize (- { W(sa).f(sa) + W(sb).f(sb) + W(ad).f(ad) + W(ac).f(ac) + W(bd).f(bd) + W(bc).f(bc) + W(dt).f(dt) + W(ct).f(ct) } )

Substituting x1 for sa, x2 for sb, x3 for ad, x4 for ac, x5 for bd, x6 for bc, x7 for dt, x8 for ct.

Finally, we get something like this:


    Maximize
        -x1-x2-10(x3)-7(x4)-12(x5)-7(x6)-x7-x8  (objective function)
    Given that (constraints)
      Capacity constraints:
         x{1-8} <= 1
      Flow conversations:
         x1 = x3+x4 --> ( x1-x3-x4 <=0 & -x1+x3+x4 <= 0)
         x2 = x6+x5 --> ( x2-x6-x5 <=0 & -x2+x6+x5 <= 0)
         x7 = x3+x5 --> ( x7-x3-x5 <=0 & -x7+x3+x5 <= 0)
         x8 = x4+x6 --> ( x8-x4-x6 <=0 & -x8+x4+x6 <= 0)
      Demand:
         x1 + x2 =2 --> ( x1+x2 <=2 && -x1-x2 <=2)

According to CLRS, The first part of simplex is to obtain a initial slack form with a feasible solution using the INITIALISE-SIMPLEX method.

This method checks if there are any negative values on the right hand side of the inequalities in the constraints. If not it returns the current setting as the initial slack form for the main algorithm to process.

In the main algorithm the first step is to choose a Non-basic variable whose coefficient is non-negative in the objective function.

But in this case, all the variables in the objective function have a negative coefficient(since we multiplied the initial obj function to convert minimization to maximization form).

So simplex will terminate with 0 as flow values for all the edges ?

I fed the above problem to "linear_solver in google OR-Tools library". And it returns the correct result as 21 and x3 =1 & x4 =0 & x5 =0 & x6 =1

So i think my equations are right.

CLRS doesn't handle this case, or am i missing something ?

Abis
  • 155
  • 8
  • (1) Choosing the entering variable is based on the reduced cost (not the objective coefficient). (2) The algorithm has very little in common with how practical Simplex codes are implemented. It should only be used a didactic tool, not as a blueprint for a real implementation. – Erwin Kalvelagen Apr 18 '19 at 10:27
  • @ErwinKalvelagen, But according to CLRS, choosing the entering variable is based on objective coefficient. By increasing the value of those non-basic variables which have +ive coefficients, the objective value can be increased in each iteration – Abis Apr 18 '19 at 11:57
  • 1
    It probably does not say that. Again **In the simplex method choosing the entering variable is based on the reduced cost (not the objective coefficient)**. – Erwin Kalvelagen Apr 18 '19 at 12:34
  • Quoting CLRS: "If all coefficients in the objective function are negative, then the while loop terminates. Otherwise, line4 selects a variable xe, whose coefficient in the objective function is positive, as the entering variable." – Abis Apr 18 '19 at 13:02
  • @Abis The quote you provide has to be interpreted in presence of what `PIVOT` [as called from `INITIALIZE-SIMPLEX`] does to `c`, the "objective function" -- which, basically, as @Erwin pointed to, handles `c` as function of "[reduced cost](https://en.wikipedia.org/wiki/Reduced_cost)"s. – fbahr Apr 26 '19 at 17:31

1 Answers1

1

Actually, the problem with the above problem is that the "Initialize-Simplex" method would need to be more complicated in this case. Since x_i = 0 (forall i) is not a feasible solution to the problem, you would need to do a "phase-1" operation to find an initial basic feasible solution to the problem. (A solution that satisfies x1+x2 = 2). I suggest googling "phase-1 simplex method" http://www.math.ubc.ca/~israel/m340/artif.pdf. I would not suggest CLRS as a good book for explaining all details of the simplex method. An introductory Operations Research textbook like Hillier and Lieberman or Winston would be better. Best of luck!