Skip to content

Bugfix ModelCreator for required model parameters and user adjusted model parameters#2780

Merged
tpike3 merged 2 commits intomesa:mainfrom
UniK-INES:fix_viz_modelcreator
May 17, 2025
Merged

Bugfix ModelCreator for required model parameters and user adjusted model parameters#2780
tpike3 merged 2 commits intomesa:mainfrom
UniK-INES:fix_viz_modelcreator

Conversation

@Holzhauer
Copy link
Contributor

Summary

For models with required parameters, providing a user input in model_params (passed to SolarViz()) still raises a ValueError: Missing required model parameter. Passing user_params instead of fixed_params to _check_model_params resolves the issue.

Bug / Issue

Because model params are only checked for fixed_params, user adjusted parameters are not considered and mistakenly considered as missing.

Implementation

  • pass user_params instead of fixed_params to _check_model_params
  • rename user_params as return from split_model_params to user_adjust_params

Testing

see tests/test_solara_viz.py::test_model_creator()

@github-actions
Copy link

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +2.1% [+1.0%, +3.3%] 🔵 +0.3% [+0.1%, +0.5%]
BoltzmannWealth large 🔵 -0.8% [-2.3%, +0.3%] 🔵 +0.9% [-0.7%, +2.8%]
Schelling small 🔵 -0.5% [-0.6%, -0.3%] 🔵 -0.6% [-0.8%, -0.3%]
Schelling large 🔵 +1.9% [-0.9%, +6.7%] 🔵 -2.7% [-4.0%, -1.3%]
WolfSheep small 🔵 -0.1% [-0.4%, +0.2%] 🔵 -1.3% [-1.5%, -1.1%]
WolfSheep large 🔵 -3.1% [-5.0%, -1.4%] 🟢 -10.7% [-13.3%, -8.4%]
BoidFlockers small 🟢 -4.3% [-5.1%, -3.5%] 🔵 -0.4% [-0.7%, +0.0%]
BoidFlockers large 🔵 -2.2% [-2.9%, -1.5%] 🔵 -0.2% [-0.6%, +0.3%]

Copy link
Member

@tpike3 tpike3 left a comment

Choose a reason for hiding this comment

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

This is great @Holzhauer, this has needed improving for awhile!

@tpike3 tpike3 merged commit 2e6ab85 into mesa:main May 17, 2025
14 checks passed
@tpike3 tpike3 added the bug Release notes label label Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Release notes label visualisation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants