Skip to content
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

Syntax for mathematical expressions in model definitions #1085

Closed
sbenthall opened this issue Nov 22, 2021 · 4 comments
Closed

Syntax for mathematical expressions in model definitions #1085

sbenthall opened this issue Nov 22, 2021 · 4 comments
Assignees
Milestone

Comments

@sbenthall
Copy link
Contributor

A desideratum for future versions of HARK is a syntax for mathematical expressions in model definitions.

This syntax need not be the native Python syntax, though this is what is done in @llorracc 's "pre-alpha 2.0" code, which uses strings of Python and the very controversial eval function to parse them.

#1055

Dolo has its own Dolang syntax and interpreter, which is an attractive choice. I wonder if it can be extracted from the YAML context in which it is used.

In conversation with @alanlujan91 and @nicksawhney , Disciplined Convex Programming (DCP) has come up. This is a DSL for convex optimization problems developed by researchers at Stanford. It is implemented in several convex optimization packages, in different languages.

https://www.cvxpy.org/tutorial/dcp/index.html

DCP has the advantage of being featureful with respect to convex optimization -- if it can be expressed in the language, then it guarantees that it can be solved by their optimization engine (in this case CVXPY).

@sbenthall sbenthall added this to the 2.x.y milestone Nov 22, 2021
@sbenthall
Copy link
Contributor Author

I think this comment is partly a reply to this issue?

#1066 (comment)

It's a good point that discrete choice problems are not convex optimization.

@llorracc
Copy link
Collaborator

llorracc commented Nov 29, 2021 via email

@sbenthall
Copy link
Contributor Author

The current approach to this issue that's favored is to use Sympy to parse strings into symbolic expressions, and then convert these into other forms as needed.

I'm working on this in PR #1427

@sbenthall
Copy link
Contributor Author

This was solved in #1427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants