Linear programming (simplex simplex) and duality problem

Source: Internet
Author: User

Linear programming

First of all, generally all linear programming problems can be converted to the following standard type :

But we can see that all of these are inequalities, and we prefer the equation in our calculations, so we introduce this new concept: slack type :

It is clear that our final request is that all constraints to the left of the variable are not less than 0. To solve such problems, we have a very convenient model algorithm: simplex

Base variable : All variables to the left of the relaxed equation

non-base variable : All variables to the right of the relaxed equation

Basic Solution : A set of base variables and non-base variables contains a set of basic solutions, that is, all non-base variables are 0, the base variable is the right side of the constant term (this requires constant term is positive, negative when we discuss later)

Algorithm principle:

The solution space of the programmable linear programming is a convex region, which means that the global optimal solution is only one, or there are multiple parallel optimal solutions. By the nature of the above, we can know that the local optimal solution is the global optimal solution, which is the simplex algorithm idea.

Algorithm process:

Pivot operation: Select a base variable and a non-base variable to swap it

Simplex operation: The main process, starting from a basic solution, through a series of rotating shaft operation, to find the optimal solution

Example:

Solve the following problems:

First step: Interchange X1 and X6

Step two: Interchange X3 and X5

The third step: Interchange X2 and X3

At this point we get the basic solution: (x1, x2, X3, X4, x5, x6) = (8, 4, 0, 18, 0, 0), easy to verify is the final optimal solution

Algorithm pseudo-code:

1 defSimplex (A, B, c):2 initialization (A, B, c)3      whileThere isE that Ce >0 Do:4Find the index L that Ale > 0 andMinimizes bi/Ale5         ifAll L, Ale <=0 Then:6             returnunbounded7         Else:8Pivot (A, B, C, L, E)

Where we find that there is a "initialization" function that is used to process our bi<0, it is done by introducing an auxiliary linear programming :

After a rotating axis operation, the L constraint becomes:

The rest becomes:

Ishi at this time is not less than 0 for the new bi satisfaction

Duality problem

Defined:

Using matrices to represent more image, but also more conducive to our later calculation and understanding:

Therefore, we can consider the mutual transformation between them in the face of such problems. Here is no proof of the theorem:

Two groups of optimal solutions for mutual duality problems

Subsequent update of the Python implementation of the simplex algorithm ...

Linear programming (simplex simplex) and duality problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.