Add derive_focs for automatic FOC derivation from optimization problems#229
Draft
Add derive_focs for automatic FOC derivation from optimization problems#229
Conversation
…on problems Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
…_focs Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add user-friendly parser for optimization problems
Add derive_focs for automatic FOC derivation from optimization problems
Jan 5, 2026
Owner
|
@copilot use the following syntax and allow for it in the @model macro (instead of a separate derive_focs function): U[0] = maximise(log(C[0]) + ψ * log(1 - L[0]) + β * U[1], |
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Copilot stopped work on behalf of
thorek1 due to an error
January 5, 2026 22:28
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Contributor
Author
Implemented in 0bb6ae1. The optimization syntax is now integrated into the Note: Since Julia doesn't support U[0] = maximise(log(C[0]) + β * U[1], controls = [C[0], K[0]]) | begin
C[0] + K[0] = r[0] * K[-1] + (1 - δ) * K[-1]
endThis automatically derives the Euler equations from the optimization problem. |
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
maximise/maximize/minimise/minimizewith| begin ... endconstraintsSyntax
Since Julia doesn't support
subject_toas an infix operator, use the|operator:This automatically derives the FOCs (Euler equation for consumption/capital) from the optimization problem.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.