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

Restrict discrete grid codes to array indices #92

Merged
merged 6 commits into from
Sep 23, 2024
Merged

Conversation

timmens
Copy link
Member

@timmens timmens commented Sep 23, 2024

In this PR,

I remove the ability to specify general discrete grid codes. While it may be beneficial in the future, we currently do not have a use case, while the feature makes maintaining the library more complex. We have, therefore, decided to drop the feature for now. If it turns out to be needed in the future, we can easily add it by following this PR.

Additionally, I renamed the discrete deterministic test model from ISKHAKOV_ET_AL_2017_FULLY_DISCRETE to ISKHAKOV_ET_AL_2017_DISCRETE since the state is no longer discrete, only the choices.

What changed?

This was allowed before merging of this PR:

@dataclass
class Health:
   bad: int = -1
   neutral: int = 0
   good: int = 1
   
DiscreteGrid(Health)

Now, this would raise an error, and you have to specify the grid like so:

@dataclass
class Health:
   bad: int = 0
   neutral: int = 1
   good: int = 2
   
DiscreteGrid(Health)

@timmens timmens requested a review from hmgaudecker September 23, 2024 11:41
Copy link
Member

@hmgaudecker hmgaudecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice -- much easier to read!!!

tests/test_entry_point.py Outdated Show resolved Hide resolved
tests/test_models/deterministic.py Outdated Show resolved Hide resolved
tests/test_entry_point.py Outdated Show resolved Hide resolved
tests/test_entry_point.py Outdated Show resolved Hide resolved
tests/test_models/deterministic.py Show resolved Hide resolved
tests/test_models/deterministic.py Show resolved Hide resolved
Copy link
Member

@hmgaudecker hmgaudecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even nicer!

tests/input_processing/test_process_model.py Outdated Show resolved Hide resolved
tests/test_entry_point.py Outdated Show resolved Hide resolved
@timmens timmens merged commit ce8f8cf into main Sep 23, 2024
7 checks passed
@timmens timmens deleted the restrict-discrete-grids branch September 23, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants