Simplex Algorithm
|
11-12-2023, 05:11 PM
(This post was last modified: 11-12-2023 11:23 PM by Albert Chan.)
Post: #6
|
|||
|
|||
RE: Simplex Algorithm
(11-12-2023 12:38 AM)Albert Chan Wrote: Fastest is remove excess variables, turning it into slack variables. I don't know a good name for this algorithm, so I just use remove_eq_c(a, n) It remove top n "=" constraints. (n variables, if constraints are independent) In other words, only "≤" constraints remain. simplex_le(a, ±n) ≡ simplex_le(remove_eq_c(a,n), ±∞) simplex_le(a, dir) only had 1 change. Instead of more constraints, it now do less variables. < IF b<len(a) THEN a := extend(-a[1 .. b],a) END > IF b<len(a) THEN a := remove_eq_c(a, b) END Code: pivot_index(a) := Benchmark example: > m := [[3,2,1,10], [2,5,3,15], [-2,-3,-4,0]] > time(r := simplex_le(m, -2)) → 0.0077 > r \([\displaystyle \frac{-130}{7},[\frac{15}{7},0,\frac{25}{7},\frac{15}{7},0],\left(\begin{array}{cccccc} 1 & \frac{1}{7} & 0 & 1 & \frac{1}{7} & \frac{15}{7} \\ 0 & \frac{11}{7} & 1 & 0 & \frac{11}{7} & \frac{25}{7} \\ 0 & \frac{25}{7} & 0 & 0 & \frac{25}{7} & \frac{130}{7} \end{array}\right) ]\) Update Nov 12, 2023: simplex_le directly call simplex2, instead of wrapper simplex. see https://www.hpmuseum.org/forum/thread-20...#pid180152 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)