QuantEcon / QuantEcon/QuantEcon.py

Scalar function maximizer

Open
#216 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

wishlist
Dominant language
Python
Stars
2.4k
Forks
2.3k
Avg merge
3d 3h
Merged PRs (30d)
3

Description

Adding to wish list: I would like to have a 1D maximization routine in QuantEcon.py, something akin to this SciPy function:

https://github.com/scipy/scipy/blob/v0.16.1/scipy/optimize/optimize.py#L1554

The signature would be

import quantecon as qe
qe.maximize(f, a, b)  # maximize function f on [a, b]

The algorithm in the link above is Brent's method and I think that would be fine. Although perhaps it would be nice to have an optional argument concave that allows users to exploit concavity.

Rationale:

  • Could be written in Cython. The SciPy version is pure Python. Cython seems like a better option than Numba because numbafied functions cannot be passed functions as arguments. Cython functions can be passed functions.
  • SciPy and similar libraries only supply minimizers. With a maximizer code is a bit cleaner.

Notes:

I wonder how this would work if it was written in Cython and you passed in numbafied primitives. For example, if f was numbafied in the example call given above. I suspect it would work well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked SciPy optimize implementation and reviewing the existing QuantEcon.py public API. The issue proposes qe.maximize(f, a, b), with Brent's method and possibly a concavity option; done should include a settled API and a working scalar maximization routine.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.