Skip to content

RFC: minmax: Fix redundancy #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions quantecon/optimize/minmax.py
Original file line number Diff line number Diff line change
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