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
Copy file name to clipboardExpand all lines: lectures/opt_transport.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -513,7 +513,7 @@ While the two LP solvers use different algorithms (HiGHS vs. simplex), both shou
513
513
The solutions differs since there are multiple optimal solutions, but the objective values are the same
514
514
515
515
```{code-cell} ipython3
516
-
- res_qe.fun == res.fun
516
+
np.allclose(- res_qe.fun, res.fun)
517
517
```
518
518
519
519
```{code-cell} ipython3
@@ -538,6 +538,10 @@ Let's do a speed comparison between `scipy.optimize.linprog` and `quantecon.opti
538
538
539
539
As you can see, the `quantecon.optimize.linprog_simplex` is much faster.
540
540
541
+
(Note however, that the SciPy version is probably more stable than the
542
+
QuantEcon version, having been tested more extensively over a longer period of
543
+
time.)
544
+
541
545
## The Dual Problem
542
546
543
547
Let $u, v$ denotes vectors of dual decision variables with entries $(u_i), (v_j)$.
@@ -591,15 +595,15 @@ print("u:", res_dual.x[:m])
591
595
print("v:", res_dual.x[-n:])
592
596
```
593
597
594
-
Fortunately, `quantecon.optimize.linprog_simplex` already computes and returns the dual variables alongside the primal solution, eliminating the need for a separate dual solve.
598
+
`quantecon.optimize.linprog_simplex` computes and returns the dual variables alongside the primal solution.
595
599
596
600
The dual variables (shadow prices) can be extracted directly from the primal solution:
597
601
598
602
```{code-cell} ipython3
599
-
# The dual variables are returned automatically by linprog_simplex
603
+
# The dual variables are returned by linprog_simplex
0 commit comments