Code a linear programming exercise by hand

后端 未结 2 400
自闭症患者
自闭症患者 2021-02-09 06:16

I have been doing linear programming problems in my class by graphing them but I would like to know how to write a program for a particular problem to solve it for me. If there

2条回答
  •  既然无缘
    2021-02-09 07:02

    There are quite a number of Simplex Implementations that you will find if you search.

    In addition to the one mentioned in the comment (Numerical Recipes in C), you can also find:

    1. Google's own Simplex-Solver
    2. Then there's COIN-OR
    3. GNU has its own GLPK
    4. If you want a C++ implementation, this one in Google Code is actually accessible.
    5. There are many implementations in R including the boot package. (In R, you can see the implementation of a function by typing it without the parenthesis.)

    To address your other two questions:

    1. Will all LPs be coded the same way? Yes, a generic LP solver can be written to load and solve any LP. (There are industry standard formats for reading LP's like mps and .lp

    2. Would brute force work? Keep in mind that many companies and big organizations spend a long time on fine tuning the solvers. There are LP's that have interesting properties that many solvers will try to exploit. Also, certain computations can be solved in parallel. The algorithm is exponential, so at some large number of variables/constraints, brute force won't work.

    Hope that helps.

提交回复
热议问题