I have just completed a script to help learn about duality in linear programming.

Many real world problems can be formulated as Linear Programming problems. There are often many different ways to formulate a single problem. Some of these alternative formulations can easily be proven to be equal via simple algebra and arithmetic. For example, one person may see a problem as maximizing profit while another may see the same problem as minimizing losses. The relationship between the two alternative formulations can then be shown to be that one simply has the negative objective function value of the other.

Sometimes, though, this relationship between alternative formulations is not as easy to detect. Two alternative formulations that arise regularly in linear programming problems are a primal problem and a dual problem. The dual of a linear programming problem is the problem of finding the best bound on the objective function in terms of the constraints. This dual is formulated so that every feasible solution to the dual is a bound on the primal objective function. The Weak Duality Theorem for Linear Programming says that the optimal solution for a minimization problem is always an upper bound for its dual (which is a corresponding maximization problem). Correspondingly, the optimal solution for a maximization problem is always a lower bound for its dual. This leads to the Strong Duality Theorem for Linear Programming which says that if we can find feasible solutions to the primal and dual problems with matching objective function values, then both of these solutions must be optimal for their respective problems.

This shows an importance of duality. What my script provides is a means of formulating the dual of a given problem to help understand the concept.

The rules for constructing a dual linear program are as follows:

Primal: | Dual: |

The i^{th} constraint is [<=] | Variable y_{i} is [>=] 0 |

The i^{th} constraint is [>=] | Variable y_{i} is is [<=] 0 |

The i^{th} constraint is = | Variable y_{i} is unbounded |

Variable x_{j} is [>=] 0 | The j^{th} constraint is [>=] |

Variable x_{j} is [<=] 0 | The j^{th} constraint is [<=] |

Variable x_{j} is unbounded | The j^{th} constraint is = |

Other Blogs that have covered this topic:

A Narrow Margin

Optimization and data mining

c programming sample codes https://c.happycodings.com/for-loops-and-while-loops/