# psuedo code to solve for euler equations with neural networks

/*
# bellman with policy function

Vt(Θ) = F(Θ,x(Θ)) + β Vtt(G(Θ,x(Θ)))
    where x() maximizes the standard bellman
    a-g(Θ,x) < 0

## Setting up the euler equation

### Stationarity (optimality) Conditions
0 =set= ∇Vt wrt x() - λ
    - Implies definition of ∇Vtt wrt G() in terms of x(), λ, and Θ
#### Complementary Slackness Conditions
λ * (a-g()) = 0 and one of the terms is greater than zero.
    - There is a continuous, roughly parabolic alternative 
        to this condition called the Fisher-Burmeister function.

### Envelope Conditions
∇Vt wrt Θ = ∇F wrt Θ + β ∇Vtt wrt G X ∇G wrt Θ
    - This defines ∇Vtt wrt G in terms of Θ,x,∇F, and ∇Vt wrt Θ
        which we call the time-transition function.
    - It turns out to be an affine problem
    - There are invertibility conditions that are important to be aware of.
*/


// Setup envelope conditions
// Set up laws of motion
// Recursive definition of time-transition function.

// Increment optimality/stationarity conditions
// Substitute time-transition function as needed into stationarity conditions

// Choose the set of transitioned, stationarity conditions you will be using
// Set them into a vector of conditions.
// Now you should have a vector function in terms of Θ, x(), and maybe ∇Vtt.
// Make sure to add the complementary slackness conditions

// Set up loss functions
// The most basic is the l_2 metric on the vector.
// It may be worth making a penalized loss function, but you do you.

// Generate your initial neural network
// If you didn't solve out ∇Vtt, generate that as a neural network.
// Honestly though, you should probably just solve it out.

// Substitute the neural network into the loss function
// Generate a variety of states.
// Start using some gradient descent to train the model

// Notice some error you made, and start over again (do you want to account for asymmetry in the utility functions?)
