Skip to content

Commit

Permalink
RFC: minmax: Fix redundancy (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
oyamad committed May 19, 2021
1 parent 62c2d55 commit 708a699
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions quantecon/optimize/minmax.py
Expand Up @@ -4,7 +4,7 @@
"""
import numpy as np
from numba import jit
from .linprog_simplex import _set_criterion_row, solve_tableau, PivOptions
from .linprog_simplex import solve_tableau, PivOptions
from .pivoting import _pivoting


Expand Down Expand Up @@ -45,10 +45,10 @@ def minmax(A, max_iter=10**6, piv_options=PivOptions()):
Value :math:`v^*` of the minmax problem.
x : ndarray(float, ndim=1)
Optimal solution :math:`x^*`, of shape (,m).
Optimal solution :math:`x^*`, of shape (m,).
y : ndarray(float, ndim=1)
Optimal solution :math:`y^*`, of shape (,n).
Optimal solution :math:`y^*`, of shape (n,).
"""
m, n = A.shape
Expand All @@ -68,6 +68,7 @@ def minmax(A, max_iter=10**6, piv_options=PivOptions()):

tableau[-2, :n] = 1
tableau[-2, -1] = 1
tableau[-1, n] = -1

# Phase 1
pivcol = 0
Expand All @@ -86,11 +87,6 @@ def minmax(A, max_iter=10**6, piv_options=PivOptions()):
basis[pivrow] = n
basis[-1] = 0

# Modify the criterion row for Phase 2
c = np.zeros(n+1)
c[-1] = -1
_set_criterion_row(c, basis, tableau)

# Phase 2
solve_tableau(tableau, basis, max_iter-2, skip_aux=False,
piv_options=piv_options)
Expand Down

0 comments on commit 708a699

Please sign in to comment.