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

Simulator: hand in rules one at a time or all together? #571

Closed
sbenthall opened this issue Mar 16, 2020 · 4 comments
Closed

Simulator: hand in rules one at a time or all together? #571

sbenthall opened this issue Mar 16, 2020 · 4 comments

Comments

@sbenthall
Copy link
Contributor

@llorracc writes:

An important question to think about as we move in that direction is whether the right approach is to have a simulator that just simulates one period at a time and we expect the user to feed it a sequence of rules one by one, in which case it is up to the user to feed the simulator the rules in the right order, or whether we want to be able to feed the simulator an entire sequence of decision rules and have it do all of them together and then return a result. If there were no considerations of efficiency, I'd vote for the former approach, but it could be that such an approach would be highly inefficient and slow because there would be so many objects being passed back and forth between the one-step simulator and the code that was using it to produce a sequence of periods.

@sbenthall
Copy link
Contributor Author

I'm a little lost on this one.
@llorracc could you explain what you meant here? Otherwise, I'll close the ticket.

@llorracc
Copy link
Collaborator

llorracc commented Dec 9, 2020

Like, in the portfolio model.

Step Rule Description State-In State-Out
a aFunc consumption function yields a m is a real; a is NaN ; PortShare is NaN m is the same real; a is a real ; PortShare is NaN
PortShare PortShareFunc calculate portfolio share given a m is same real as before; a is real caculated in a step; PortShare is NaN m, a same reals as before; PortShare is a real between 0 and 1

All I'm saying is does our simulator:

  1. Feed the input states to rule a and retrieve the output states, then take those and feed them as input states to rule PortShare, then take those, increment the period by one, and feed them to the input rule to a, or
  2. Feed the input states to something that is a PortfolioModel object, which executes all the stages, then returns to the simulator all of the results of all the stages.

@sbenthall
Copy link
Contributor Author

I think (2) can be (1) considered at a different level of abstraction.

@sbenthall sbenthall modified the milestones: 1.0.0, 1.x.y Jan 14, 2021
@sbenthall sbenthall modified the milestones: 1.x.y, 1.1.0 Jan 23, 2021
@alanlujan91 alanlujan91 self-assigned this Aug 19, 2022
@mnwhite
Copy link
Contributor

mnwhite commented Jul 3, 2024

Closing as stale, and never really understood as an issue. I agree with Seb that this is just a matter of abstraction. Efficiency-wise, passing objects in Python isn't costly because it's a memory pointer. Doing so in Matlab (e.g.) is very costly because a new copy is created in memory.

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

No branches or pull requests

4 participants