From 152c067552ed19cf6379340483822d9a73d8b89c Mon Sep 17 00:00:00 2001 From: John Stachurski Date: Wed, 6 Jun 2018 22:03:48 +1000 Subject: [PATCH 01/12] adding jitted scalar maximization routine, first build --- quantecon/__init__.py | 1 + quantecon/optimize/__init__.py | 6 + quantecon/optimize/scalar_maximization.py | 135 ++++++++++++++++++++ quantecon/optimize/tests/test_scalar_max.py | 39 ++++++ quantecon/version.py | 2 +- 5 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 quantecon/optimize/__init__.py create mode 100644 quantecon/optimize/scalar_maximization.py create mode 100644 quantecon/optimize/tests/test_scalar_max.py diff --git a/quantecon/__init__.py b/quantecon/__init__.py index 7600dc6e4..1428a7f35 100644 --- a/quantecon/__init__.py +++ b/quantecon/__init__.py @@ -12,6 +12,7 @@ from . import game_theory from . import quad from . import random +from . import optimize #-Objects-# from .compute_fp import compute_fixed_point diff --git a/quantecon/optimize/__init__.py b/quantecon/optimize/__init__.py new file mode 100644 index 000000000..ea25f0199 --- /dev/null +++ b/quantecon/optimize/__init__.py @@ -0,0 +1,6 @@ +""" +Initialization of the optimize subpackage +""" + +from .scalar_maximization import maximize_scalar + diff --git a/quantecon/optimize/scalar_maximization.py b/quantecon/optimize/scalar_maximization.py new file mode 100644 index 000000000..b2ddc5f15 --- /dev/null +++ b/quantecon/optimize/scalar_maximization.py @@ -0,0 +1,135 @@ +import numpy as np +from numba import jit, njit + +@njit +def maximize_scalar(func, a, b, xtol=1e-5, maxiter=500): + """ + Uses a jitted version of the maximization routine from SciPy's fminbound. + The algorithm is identical except that it's been switched to maximization + rather than minimization, and the tests for convergence have been stripped + out to allow for jit compilation. + + Note that the input function `func` must be jitted or the call will fail. + + Parameters + ---------- + maxiter : int, optional + Maximum number of iterations to perform. + xtol : float, optional + Absolute error in solution `xopt` acceptable for convergence. + func : jitted function + a : scalar + Lower bound for search + b : scalar + Upper bound for search + + Returns + ------- + fval : float + The maximum value attained + xf : float + The maxizer + + Example + ------- + + ``` + @njit + def f(x): + return -(x + 2.0)**2 + 1.0 + + fval, xf = maximize_scalar(f, -2, 2) + ``` + + """ + maxfun = maxiter + + sqrt_eps = np.sqrt(2.2e-16) + golden_mean = 0.5 * (3.0 - np.sqrt(5.0)) + + fulc = a + golden_mean * (b - a) + nfc, xf = fulc, fulc + rat = e = 0.0 + x = xf + fx = -func(x) + num = 1 + fmin_data = (1, xf, fx) + + ffulc = fnfc = fx + xm = 0.5 * (a + b) + tol1 = sqrt_eps * np.abs(xf) + xtol / 3.0 + tol2 = 2.0 * tol1 + + while (np.abs(xf - xm) > (tol2 - 0.5 * (b - a))): + golden = 1 + # Check for parabolic fit + if np.abs(e) > tol1: + golden = 0 + r = (xf - nfc) * (fx - ffulc) + q = (xf - fulc) * (fx - fnfc) + p = (xf - fulc) * q - (xf - nfc) * r + q = 2.0 * (q - r) + if q > 0.0: + p = -p + q = np.abs(q) + r = e + e = rat + + # Check for acceptability of parabola + if ((np.abs(p) < np.abs(0.5*q*r)) and (p > q*(a - xf)) and + (p < q * (b - xf))): + rat = (p + 0.0) / q + x = xf + rat + + if ((x - a) < tol2) or ((b - x) < tol2): + si = np.sign(xm - xf) + ((xm - xf) == 0) + rat = tol1 * si + else: # do a golden section step + golden = 1 + + if golden: # Do a golden-section step + if xf >= xm: + e = a - xf + else: + e = b - xf + rat = golden_mean*e + + if rat == 0: + si = np.sign(rat) + 1 + else: + si = np.sign(rat) + + x = xf + si * np.maximum(np.abs(rat), tol1) + fu = -func(x) + num += 1 + fmin_data = (num, x, fu) + + if fu <= fx: + if x >= xf: + a = xf + else: + b = xf + fulc, ffulc = nfc, fnfc + nfc, fnfc = xf, fx + xf, fx = x, fu + else: + if x < xf: + a = x + else: + b = x + if (fu <= fnfc) or (nfc == xf): + fulc, ffulc = nfc, fnfc + nfc, fnfc = x, fu + elif (fu <= ffulc) or (fulc == xf) or (fulc == nfc): + fulc, ffulc = x, fu + + xm = 0.5 * (a + b) + tol1 = sqrt_eps * np.abs(xf) + xtol / 3.0 + tol2 = 2.0 * tol1 + + if num >= maxfun: + break + + fval = -fx + + return fval, xf diff --git a/quantecon/optimize/tests/test_scalar_max.py b/quantecon/optimize/tests/test_scalar_max.py new file mode 100644 index 000000000..9e09fb507 --- /dev/null +++ b/quantecon/optimize/tests/test_scalar_max.py @@ -0,0 +1,39 @@ +""" +Tests for scalar maximization. + +""" +import numpy as np +from numpy.testing import assert_almost_equal +from numba import njit + +from quantecon.optimize import maximize_scalar + +@njit +def f(x): + """ + A function for testing on. + """ + return -(x + 2.0)**2 + 1.0 + +def test_maximize_scalar(): + """ + Uses the function f defined above to test the scalar maximization + routine. + """ + true_fval = 1.0 + true_xf = -2.0 + fval, xf = maximize_scalar(f, -2, 2) + assert_almost_equal(true_fval, fval, decimal=4) + assert_almost_equal(true_xf, xf, decimal=4) + + +if __name__ == '__main__': + import sys + import nose + + argv = sys.argv[:] + argv.append('--verbose') + argv.append('--nocapture') + nose.main(argv=argv, defaultTest=__file__) + + diff --git a/quantecon/version.py b/quantecon/version.py index e38e023ca..aad6dede3 100644 --- a/quantecon/version.py +++ b/quantecon/version.py @@ -1,4 +1,4 @@ """ This is a VERSION file and should NOT be manually altered """ -version = '0.3.7' \ No newline at end of file +version = '0.3.8' \ No newline at end of file From 43845796a1bbb51002d89fc41886588126171c1e Mon Sep 17 00:00:00 2001 From: Natasha Date: Thu, 7 Jun 2018 14:18:09 +0200 Subject: [PATCH 02/12] add args arguments --- quantecon/optimize/scalar_maximization.py | 17 ++++++++++------- quantecon/optimize/tests/test_scalar_max.py | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/quantecon/optimize/scalar_maximization.py b/quantecon/optimize/scalar_maximization.py index b2ddc5f15..f39bcf4c9 100644 --- a/quantecon/optimize/scalar_maximization.py +++ b/quantecon/optimize/scalar_maximization.py @@ -2,7 +2,7 @@ from numba import jit, njit @njit -def maximize_scalar(func, a, b, xtol=1e-5, maxiter=500): +def maximize_scalar(func, a, b, args=(), xtol=1e-5, maxiter=500): """ Uses a jitted version of the maximization routine from SciPy's fminbound. The algorithm is identical except that it's been switched to maximization @@ -13,15 +13,17 @@ def maximize_scalar(func, a, b, xtol=1e-5, maxiter=500): Parameters ---------- - maxiter : int, optional - Maximum number of iterations to perform. - xtol : float, optional - Absolute error in solution `xopt` acceptable for convergence. func : jitted function a : scalar Lower bound for search b : scalar Upper bound for search + args : tuple, optional + Extra arguments passed to the objective function. + maxiter : int, optional + Maximum number of iterations to perform. + xtol : float, optional + Absolute error in solution `xopt` acceptable for convergence. Returns ------- @@ -42,6 +44,7 @@ def f(x): ``` """ + maxfun = maxiter sqrt_eps = np.sqrt(2.2e-16) @@ -51,7 +54,7 @@ def f(x): nfc, xf = fulc, fulc rat = e = 0.0 x = xf - fx = -func(x) + fx = -func(x, *args) num = 1 fmin_data = (1, xf, fx) @@ -100,7 +103,7 @@ def f(x): si = np.sign(rat) x = xf + si * np.maximum(np.abs(rat), tol1) - fu = -func(x) + fu = -func(x, *args) num += 1 fmin_data = (num, x, fu) diff --git a/quantecon/optimize/tests/test_scalar_max.py b/quantecon/optimize/tests/test_scalar_max.py index 9e09fb507..448f72946 100644 --- a/quantecon/optimize/tests/test_scalar_max.py +++ b/quantecon/optimize/tests/test_scalar_max.py @@ -25,6 +25,25 @@ def test_maximize_scalar(): fval, xf = maximize_scalar(f, -2, 2) assert_almost_equal(true_fval, fval, decimal=4) assert_almost_equal(true_xf, xf, decimal=4) + +@njit +def g(x, y): + """ + A multivariate function for testing on. + """ + return -x**2 + y + +def test_maximize_scalar_multivariate(): + """ + Uses the function f defined above to test the scalar maximization + routine. + """ + y = 5 + true_fval = 5.0 + true_xf = -0.0 + fval, xf = maximize_scalar(g, -10, 10, args=(y,)) + assert_almost_equal(true_fval, fval, decimal=4) + assert_almost_equal(true_xf, xf, decimal=4) if __name__ == '__main__': From c9933d3a4f510fde8fcd2c8900209a3a1d4843e2 Mon Sep 17 00:00:00 2001 From: Natasha Date: Thu, 7 Jun 2018 15:14:52 +0200 Subject: [PATCH 03/12] fix typo --- quantecon/optimize/scalar_maximization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantecon/optimize/scalar_maximization.py b/quantecon/optimize/scalar_maximization.py index f39bcf4c9..51b42fbd9 100644 --- a/quantecon/optimize/scalar_maximization.py +++ b/quantecon/optimize/scalar_maximization.py @@ -30,7 +30,7 @@ def maximize_scalar(func, a, b, args=(), xtol=1e-5, maxiter=500): fval : float The maximum value attained xf : float - The maxizer + The maximizer Example ------- From 22dce1d1f11abfe2949713ef1efc70ee02bd68b1 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 11 Jun 2018 10:38:32 +1000 Subject: [PATCH 04/12] update install requires in setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2df3ab4c8..acc7c2c34 100644 --- a/setup.py +++ b/setup.py @@ -113,7 +113,7 @@ def write_version_py(filename=None): download_url='https://github.com/QuantEcon/QuantEcon.py/tarball/' + VERSION, keywords=['quantitative', 'economics'], install_requires=[ - 'numba>=0.36.2', + 'numba>=0.38', 'numpy', 'scipy>=1.0.0', 'sympy', From e890f71279dfcb21100e99f44a5258ab934ce999 Mon Sep 17 00:00:00 2001 From: John Stachurski Date: Mon, 25 Jun 2018 16:55:53 +1000 Subject: [PATCH 05/12] added status_flag to scalar maximizer --- quantecon/optimize/scalar_maximization.py | 11 +++++++---- quantecon/optimize/tests/test_scalar_max.py | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/quantecon/optimize/scalar_maximization.py b/quantecon/optimize/scalar_maximization.py index 51b42fbd9..04130f34e 100644 --- a/quantecon/optimize/scalar_maximization.py +++ b/quantecon/optimize/scalar_maximization.py @@ -31,6 +31,9 @@ def maximize_scalar(func, a, b, args=(), xtol=1e-5, maxiter=500): The maximum value attained xf : float The maximizer + status_flag : int + Indicates whether or not the maximum number of function calls was + attained. A value of 0 implies that the maximum was not hit. Example ------- @@ -40,12 +43,13 @@ def maximize_scalar(func, a, b, args=(), xtol=1e-5, maxiter=500): def f(x): return -(x + 2.0)**2 + 1.0 - fval, xf = maximize_scalar(f, -2, 2) + fval, xf, status_flag = maximize_scalar(f, -2, 2) ``` """ maxfun = maxiter + status_flag = 0 sqrt_eps = np.sqrt(2.2e-16) golden_mean = 0.5 * (3.0 - np.sqrt(5.0)) @@ -56,7 +60,6 @@ def f(x): x = xf fx = -func(x, *args) num = 1 - fmin_data = (1, xf, fx) ffulc = fnfc = fx xm = 0.5 * (a + b) @@ -105,7 +108,6 @@ def f(x): x = xf + si * np.maximum(np.abs(rat), tol1) fu = -func(x, *args) num += 1 - fmin_data = (num, x, fu) if fu <= fx: if x >= xf: @@ -131,8 +133,9 @@ def f(x): tol2 = 2.0 * tol1 if num >= maxfun: + status_flag = 1 break fval = -fx - return fval, xf + return fval, xf, status_flag diff --git a/quantecon/optimize/tests/test_scalar_max.py b/quantecon/optimize/tests/test_scalar_max.py index 448f72946..eadf08d3a 100644 --- a/quantecon/optimize/tests/test_scalar_max.py +++ b/quantecon/optimize/tests/test_scalar_max.py @@ -22,7 +22,7 @@ def test_maximize_scalar(): """ true_fval = 1.0 true_xf = -2.0 - fval, xf = maximize_scalar(f, -2, 2) + fval, xf, status_flag = maximize_scalar(f, -2, 2) assert_almost_equal(true_fval, fval, decimal=4) assert_almost_equal(true_xf, xf, decimal=4) @@ -41,7 +41,7 @@ def test_maximize_scalar_multivariate(): y = 5 true_fval = 5.0 true_xf = -0.0 - fval, xf = maximize_scalar(g, -10, 10, args=(y,)) + fval, xf, status_flag = maximize_scalar(g, -10, 10, args=(y,)) assert_almost_equal(true_fval, fval, decimal=4) assert_almost_equal(true_xf, xf, decimal=4) From f722b25192fd6fb6647a68411087dd7a04a4ff2c Mon Sep 17 00:00:00 2001 From: John Stachurski Date: Mon, 25 Jun 2018 17:47:37 +1000 Subject: [PATCH 06/12] modified return value to include number of function calls --- quantecon/optimize/scalar_maximization.py | 11 +++++++---- quantecon/optimize/tests/test_scalar_max.py | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/quantecon/optimize/scalar_maximization.py b/quantecon/optimize/scalar_maximization.py index 04130f34e..68b415846 100644 --- a/quantecon/optimize/scalar_maximization.py +++ b/quantecon/optimize/scalar_maximization.py @@ -31,9 +31,11 @@ def maximize_scalar(func, a, b, args=(), xtol=1e-5, maxiter=500): The maximum value attained xf : float The maximizer - status_flag : int - Indicates whether or not the maximum number of function calls was + info : tuple + A tuple of the form (status_flag, num_iter). Here status_flag + indicates whether or not the maximum number of function calls was attained. A value of 0 implies that the maximum was not hit. + The value `num_iter` is the number of function calls. Example ------- @@ -43,7 +45,7 @@ def maximize_scalar(func, a, b, args=(), xtol=1e-5, maxiter=500): def f(x): return -(x + 2.0)**2 + 1.0 - fval, xf, status_flag = maximize_scalar(f, -2, 2) + fval, xf, info = maximize_scalar(f, -2, 2) ``` """ @@ -137,5 +139,6 @@ def f(x): break fval = -fx + info = status_flag, num - return fval, xf, status_flag + return fval, xf, info diff --git a/quantecon/optimize/tests/test_scalar_max.py b/quantecon/optimize/tests/test_scalar_max.py index eadf08d3a..a1ddd4d5f 100644 --- a/quantecon/optimize/tests/test_scalar_max.py +++ b/quantecon/optimize/tests/test_scalar_max.py @@ -22,7 +22,7 @@ def test_maximize_scalar(): """ true_fval = 1.0 true_xf = -2.0 - fval, xf, status_flag = maximize_scalar(f, -2, 2) + fval, xf, info = maximize_scalar(f, -2, 2) assert_almost_equal(true_fval, fval, decimal=4) assert_almost_equal(true_xf, xf, decimal=4) @@ -41,7 +41,7 @@ def test_maximize_scalar_multivariate(): y = 5 true_fval = 5.0 true_xf = -0.0 - fval, xf, status_flag = maximize_scalar(g, -10, 10, args=(y,)) + fval, xf, info = maximize_scalar(g, -10, 10, args=(y,)) assert_almost_equal(true_fval, fval, decimal=4) assert_almost_equal(true_xf, xf, decimal=4) From 70be9530f3808540694d456a4fe83859d59a0537 Mon Sep 17 00:00:00 2001 From: John Stachurski Date: Mon, 25 Jun 2018 18:40:05 +1000 Subject: [PATCH 07/12] modified return value to accommodate feedback and changed function name to brent_max --- quantecon/optimize/__init__.py | 2 +- quantecon/optimize/scalar_maximization.py | 10 +++++----- quantecon/optimize/tests/test_scalar_max.py | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/quantecon/optimize/__init__.py b/quantecon/optimize/__init__.py index ea25f0199..4937fb738 100644 --- a/quantecon/optimize/__init__.py +++ b/quantecon/optimize/__init__.py @@ -2,5 +2,5 @@ Initialization of the optimize subpackage """ -from .scalar_maximization import maximize_scalar +from .scalar_maximization import brent_max diff --git a/quantecon/optimize/scalar_maximization.py b/quantecon/optimize/scalar_maximization.py index 68b415846..9eff745fb 100644 --- a/quantecon/optimize/scalar_maximization.py +++ b/quantecon/optimize/scalar_maximization.py @@ -2,7 +2,7 @@ from numba import jit, njit @njit -def maximize_scalar(func, a, b, args=(), xtol=1e-5, maxiter=500): +def brent_max(func, a, b, args=(), xtol=1e-5, maxiter=500): """ Uses a jitted version of the maximization routine from SciPy's fminbound. The algorithm is identical except that it's been switched to maximization @@ -27,10 +27,10 @@ def maximize_scalar(func, a, b, args=(), xtol=1e-5, maxiter=500): Returns ------- - fval : float - The maximum value attained xf : float The maximizer + fval : float + The maximum value attained info : tuple A tuple of the form (status_flag, num_iter). Here status_flag indicates whether or not the maximum number of function calls was @@ -45,7 +45,7 @@ def maximize_scalar(func, a, b, args=(), xtol=1e-5, maxiter=500): def f(x): return -(x + 2.0)**2 + 1.0 - fval, xf, info = maximize_scalar(f, -2, 2) + xf, fval, info = maximize_scalar(f, -2, 2) ``` """ @@ -141,4 +141,4 @@ def f(x): fval = -fx info = status_flag, num - return fval, xf, info + return xf, fval, info diff --git a/quantecon/optimize/tests/test_scalar_max.py b/quantecon/optimize/tests/test_scalar_max.py index a1ddd4d5f..b05c00113 100644 --- a/quantecon/optimize/tests/test_scalar_max.py +++ b/quantecon/optimize/tests/test_scalar_max.py @@ -6,7 +6,7 @@ from numpy.testing import assert_almost_equal from numba import njit -from quantecon.optimize import maximize_scalar +from quantecon.optimize import brent_max @njit def f(x): @@ -15,14 +15,14 @@ def f(x): """ return -(x + 2.0)**2 + 1.0 -def test_maximize_scalar(): +def test_brent_max(): """ Uses the function f defined above to test the scalar maximization routine. """ true_fval = 1.0 true_xf = -2.0 - fval, xf, info = maximize_scalar(f, -2, 2) + xf, fval, info = brent_max(f, -2, 2) assert_almost_equal(true_fval, fval, decimal=4) assert_almost_equal(true_xf, xf, decimal=4) @@ -33,7 +33,7 @@ def g(x, y): """ return -x**2 + y -def test_maximize_scalar_multivariate(): +def test_brent_max(): """ Uses the function f defined above to test the scalar maximization routine. @@ -41,7 +41,7 @@ def test_maximize_scalar_multivariate(): y = 5 true_fval = 5.0 true_xf = -0.0 - fval, xf, info = maximize_scalar(g, -10, 10, args=(y,)) + xf, fval, info = brent_max(g, -10, 10, args=(y,)) assert_almost_equal(true_fval, fval, decimal=4) assert_almost_equal(true_xf, xf, decimal=4) From 44df5dfd6e39f01208c155c0d0c8aa7a92e1f333 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 26 Jun 2018 11:02:08 +1000 Subject: [PATCH 08/12] add optimize subpackage to docs --- docs/qe_apidoc.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/docs/qe_apidoc.py b/docs/qe_apidoc.py index ffc345b5e..582bdcef1 100644 --- a/docs/qe_apidoc.py +++ b/docs/qe_apidoc.py @@ -80,6 +80,15 @@ :show-inheritance: """ +optimize_module_template = """{mod_name} +{equals} + +.. automodule:: quantecon.optimize.{mod_name} + :members: + :undoc-members: + :show-inheritance: +""" + random_module_template = """{mod_name} {equals} @@ -211,6 +220,12 @@ def model_tool(): # Alphabetize markov.sort() + # list file names with optimize + optimize_files = glob("../quantecon/optimize/[a-z0-9]*.py") + optimize = list(map(lambda x: x.split('/')[-1][:-3], optimize_files)) + # Alphabetize + optimize.sort() + # list file names with random random_files = glob("../quantecon/random/[a-z0-9]*.py") random = list(map(lambda x: x.split('/')[-1][:-3], random_files)) @@ -230,7 +245,7 @@ def model_tool(): # Alphabetize util.sort() - for folder in ["game_theory", "markov", "random", "tools", "util"]: + for folder in ["game_theory", "markov", "optimize", "random", "tools", "util"]: if not os.path.exists(source_join(folder)): os.makedirs(source_join(folder)) @@ -257,6 +272,13 @@ def model_tool(): equals = "=" * len(mod) f.write(markov_module_template.format(mod_name=mod, equals=equals)) + # Write file for each optimize file + for mod in optimize: + new_path = os.path.join("source", "optimize", mod + ".rst") + with open(new_path, "w") as f: + equals = "=" * len(mod) + f.write(optimize_module_template.format(mod_name=mod, equals=equals)) + # Write file for each random file for mod in random: new_path = os.path.join("source", "random", mod + ".rst") @@ -284,24 +306,28 @@ def model_tool(): gt = "game_theory/" + "\n game_theory/".join(game_theory) mark = "markov/" + "\n markov/".join(markov) + opti = "optimize/" + "\n optimize/".join(optimize) rand = "random/" + "\n random/".join(random) tlz = "tools/" + "\n tools/".join(tools) utls = "util/" + "\n util/".join(util) #-TocTree-# toc_tree_list = {"game_theory": gt, "markov": mark, + "optimize" : opti, "tools": tlz, "random": rand, "util": utls, } - for f_name in ("game_theory", "markov", "random", "tools", "util"): + for f_name in ("game_theory", "markov", "optimize", "random", "tools", "util"): with open(source_join(f_name + ".rst"), "w") as f: m_name = f_name if f_name == "game_theory": f_name = "Game Theory" #Produce Nicer Title for Game Theory Module if f_name == "util": f_name = "Utilities" #Produce Nicer Title for Utilities Module + if f_name == "optimize": + f_name = "Optimize" temp = split_file_template.format(name=f_name.capitalize(), equals="="*len(f_name), files=toc_tree_list[m_name]) From 75268959cadc9c3455e0ea4404470e90a629255a Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 26 Jun 2018 11:32:06 +1000 Subject: [PATCH 09/12] add optimize to top level index and setup for installation --- docs/source/index.rst | 1 + setup.py | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/source/index.rst b/docs/source/index.rst index 9e969cea5..6dcf25317 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -13,6 +13,7 @@ mainly used by developers internal to the package. game_theory markov + optimize random tools util diff --git a/setup.py b/setup.py index acc7c2c34..efbe6f05c 100644 --- a/setup.py +++ b/setup.py @@ -98,6 +98,7 @@ def write_version_py(filename=None): 'quantecon.game_theory', 'quantecon.game_theory.game_generators', 'quantecon.markov', + 'quantecon.optimize', 'quantecon.random', 'quantecon.tests', 'quantecon.util', From 7f24600713b94004b5503a02e2b669457a46b784 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 26 Jun 2018 11:59:38 +1000 Subject: [PATCH 10/12] add tracked generated sources --- docs/source/index.rst | 1 - docs/source/optimize.rst | 7 +++++++ docs/source/optimize/scalar_maximization.rst | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 docs/source/optimize.rst create mode 100644 docs/source/optimize/scalar_maximization.rst diff --git a/docs/source/index.rst b/docs/source/index.rst index 6dcf25317..9e969cea5 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -13,7 +13,6 @@ mainly used by developers internal to the package. game_theory markov - optimize random tools util diff --git a/docs/source/optimize.rst b/docs/source/optimize.rst new file mode 100644 index 000000000..7aa11d50d --- /dev/null +++ b/docs/source/optimize.rst @@ -0,0 +1,7 @@ +Optimize +======== + +.. toctree:: + :maxdepth: 2 + + optimize/scalar_maximization diff --git a/docs/source/optimize/scalar_maximization.rst b/docs/source/optimize/scalar_maximization.rst new file mode 100644 index 000000000..af15d0538 --- /dev/null +++ b/docs/source/optimize/scalar_maximization.rst @@ -0,0 +1,7 @@ +scalar_maximization +=================== + +.. automodule:: quantecon.optimize.scalar_maximization + :members: + :undoc-members: + :show-inheritance: From d221eb1b3cdf5de3f83b0f326cedc46d08b965c3 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 26 Jun 2018 14:11:05 +1000 Subject: [PATCH 11/12] fix index generation --- docs/qe_apidoc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/qe_apidoc.py b/docs/qe_apidoc.py index 582bdcef1..3c4c87c9d 100644 --- a/docs/qe_apidoc.py +++ b/docs/qe_apidoc.py @@ -142,6 +142,7 @@ game_theory markov + optimize random tools util From 09b553196a7334a5fca84fbd9b5606f48e97eca1 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 26 Jun 2018 14:21:53 +1000 Subject: [PATCH 12/12] add tracked generated source files --- docs/source/index.rst | 1 + docs/source/tools.rst | 1 + docs/source/tools/filter.rst | 7 +++++++ 3 files changed, 9 insertions(+) create mode 100644 docs/source/tools/filter.rst diff --git a/docs/source/index.rst b/docs/source/index.rst index 9e969cea5..6dcf25317 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -13,6 +13,7 @@ mainly used by developers internal to the package. game_theory markov + optimize random tools util diff --git a/docs/source/tools.rst b/docs/source/tools.rst index ef3923f93..7b8456710 100644 --- a/docs/source/tools.rst +++ b/docs/source/tools.rst @@ -11,6 +11,7 @@ Tools tools/distributions tools/ecdf tools/estspec + tools/filter tools/graph_tools tools/gridtools tools/ivp diff --git a/docs/source/tools/filter.rst b/docs/source/tools/filter.rst new file mode 100644 index 000000000..f102fb19b --- /dev/null +++ b/docs/source/tools/filter.rst @@ -0,0 +1,7 @@ +filter +====== + +.. automodule:: quantecon.filter + :members: + :undoc-members: + :show-inheritance: