1

I'm developing a program which repeatedly needs the dual optimal of a certain linear programming problem. There is a fast algorithm to obtain the primal solution and I want to use this primal solution to obtain the dual optimum.

I have heard that you are supposed to be able to do this using a system of linear equations. So I transpose the restriction matrix A and add slack variables to each constraint to get equalities. Next I add equalities setting dual (slack) variables to zero if I know that they are by complementary slackness.

Here is where my problem arises, I end up with fewer constraints than variables, rendering the system of equation useless. My question therefore is; 1) Am I missing something in my procedure or 2) is there simply no guarantee that I will get enough constraints? 3) If so, is there maybe another way to obtain the dual optimum?

1 Answers1

1

You have "linear programming" in the tags --if this is the case then you'll get the dual solution "for free" while solving the primal. See this answer.

Here are the relevant bits of theory (here is a chapter on this from a popular operations research textbook):

  1. Strong duality: If the primal LP has a finite optimal value, so does the dual and the optimal values are equal.
  2. Complementary slackness: If a constraint is tight, the dual variable is non-zero, otherwise it is zero.

So, bottom line is that most solvers will give you the "shadow prices" or "duals" whenever the primal is solved, so you should just be able to read it off.

For example Gurobi,