Skip to content

Commit

Permalink
makes proper class docstring for AgentType, with AgentCount, fixes ec…
Browse files Browse the repository at this point in the history
  • Loading branch information
sbenthall committed Jan 5, 2021
1 parent a1e16c0 commit bb77dc4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
1 change: 1 addition & 0 deletions Documentation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Release Data: TBD

#### Minor Changes

* Move AgentType constructor parameters docs to class docstring so it is rendered by Sphinx.
* Remove uses of deprecated time.clock [#887](https://github.com/econ-ark/HARK/pull/887)

### 0.10.8
Expand Down
63 changes: 30 additions & 33 deletions HARK/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,38 @@ class AgentType(HARKobject):
that varies over time in the model. Each element of time_inv is the name of
a field in AgentSubType that is constant over time in the model.
Parameters
----------
solution_terminal : Solution
A representation of the solution to the terminal period problem of
this AgentType instance, or an initial guess of the solution if this
is an infinite horizon problem.
cycles : int
The number of times the sequence of periods is experienced by this
AgentType in their "lifetime". cycles=1 corresponds to a lifecycle
model, with a certain sequence of one period problems experienced
once before terminating. cycles=0 corresponds to an infinite horizon
model, with a sequence of one period problems repeating indefinitely.
pseudo_terminal : boolean
Indicates whether solution_terminal isn't actually part of the
solution to the problem (as a known solution to the terminal period
problem), but instead represents a "scrap value"-style termination.
When True, solution_terminal is not included in the solution; when
false, solution_terminal is the last element of the solution.
tolerance : float
Maximum acceptable "distance" between successive solutions to the
one period problem in an infinite horizon (cycles=0) model in order
for the solution to be considered as having "converged". Inoperative
when cycles>0.
seed : int
A seed for this instance's random number generator.
Attributes
----------
AgentCount : int
The number of agents of this type to use in simulation.
state_vars : list of string
The string labels for this AgentType's model state variables.
"""
Expand All @@ -188,39 +218,6 @@ def __init__(
seed=0,
**kwds
):
"""
Initialize an instance of AgentType by setting attributes.
Parameters
----------
solution_terminal : Solution
A representation of the solution to the terminal period problem of
this AgentType instance, or an initial guess of the solution if this
is an infinite horizon problem.
cycles : int
The number of times the sequence of periods is experienced by this
AgentType in their "lifetime". cycles=1 corresponds to a lifecycle
model, with a certain sequence of one period problems experienced
once before terminating. cycles=0 corresponds to an infinite horizon
model, with a sequence of one period problems repeating indefinitely.
pseudo_terminal : boolean
Indicates whether solution_terminal isn't actually part of the
solution to the problem (as a known solution to the terminal period
problem), but instead represents a "scrap value"-style termination.
When True, solution_terminal is not included in the solution; when
false, solution_terminal is the last element of the solution.
tolerance : float
Maximum acceptable "distance" between successive solutions to the
one period problem in an infinite horizon (cycles=0) model in order
for the solution to be considered as having "converged". Inoperative
when cycles>0.
seed : int
A seed for this instance's random number generator.
Returns
-------
None
"""
if solution_terminal is None:
solution_terminal = NullFunc()

Expand Down

0 comments on commit bb77dc4

Please sign in to comment.