You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While this routine uses the same simplex algorithm as
479
-
`scipy.optimize.linprog`, the code is accelerated by using a just-in-time
484
+
While `scipy.optimize.linprog` uses the HiGHS solver by default,
485
+
`quantecon.optimize.linprog_simplex` implements the simplex algorithm accelerated by using a just-in-time
480
486
compiler shipped in the `numba` library.
481
487
482
-
As you will see very soon, by using `scipy.optimize.linprog` the time required to solve an optimal transportation problem can be reduced significantly.
488
+
As you will see very soon, by using `quantecon.optimize.linprog_simplex` the time required to solve an optimal transportation problem can be reduced significantly.
483
489
484
490
```{code-cell} ipython3
485
491
# construct matrices/vectors for linprog_simplex
@@ -502,7 +508,13 @@ minimization, we need to put a negative sign before vector `c`.
Since the two LP solvers use the same simplex algorithm, we expect to get exactly the same solutions
511
+
While the two LP solvers use different algorithms (HiGHS vs. simplex), both should find optimal solutions.
512
+
513
+
The solutions differs since there are multiple optimal solutions, but the objective values are the same
514
+
515
+
```{code-cell} ipython3
516
+
np.allclose(-res_qe.fun, res.fun)
517
+
```
506
518
507
519
```{code-cell} ipython3
508
520
res_qe.x.reshape((m, n), order='C')
@@ -530,7 +542,6 @@ As you can see, the `quantecon.optimize.linprog_simplex` is much faster.
530
542
QuantEcon version, having been tested more extensively over a longer period of
531
543
time.)
532
544
533
-
534
545
## The Dual Problem
535
546
536
547
Let $u, v$ denotes vectors of dual decision variables with entries $(u_i), (v_j)$.
@@ -584,48 +595,23 @@ print("u:", res_dual.x[:m])
584
595
print("v:", res_dual.x[-n:])
585
596
```
586
597
587
-
We can also solve the dual problem using [quantecon.optimize.linprog_simplex](https://quanteconpy.readthedocs.io/en/latest/optimize/linprog_simplex.html).
0 commit comments