Skip to content

Experimental/parameter parsing#164

Merged
justin-ven merged 4 commits intodevelopfrom
experimental/parameter_parsing
May 6, 2025
Merged

Experimental/parameter parsing#164
justin-ven merged 4 commits intodevelopfrom
experimental/parameter_parsing

Conversation

@andrewbaxter439
Copy link
Copy Markdown
Collaborator

What

  • Adds a startup element to SimPathsMultiRun which reads parameter configs from config file
  • Allows some of these to be amended

Why

  • Changing parameters between runs could be done quickly with config files, rather than rebuilding the model
  • This would allow script-based runs of subsequent models with tweaked parameters

@andrewbaxter439 andrewbaxter439 marked this pull request as ready for review April 14, 2025 20:36
@andrewbaxter439 andrewbaxter439 requested a review from Copilot April 14, 2025 20:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds configuration-based parameter parsing to SimPathsMultiRun, allowing model parameters to be dynamically updated from a config file without rebuilding the model.

  • Introduces a new static map (parameterArgs) to store parameter configurations.
  • Updates the YAML config parser to extract "parameter_args" and calls an overloaded updateParameters method.
  • Alters the Parameters class by removing the final modifier from some fields to allow dynamic updates.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/main/java/simpaths/experiment/SimPathsMultiRun.java Added support for reading and updating parameter arguments using reflection.
src/main/java/simpaths/data/Parameters.java Modified constant fields to be mutable to support dynamic parameter updates.
Comments suppressed due to low confidence (2)

src/main/java/simpaths/experiment/SimPathsMultiRun.java:382

  • [nitpick] Consider renaming the method parameter 'parameter_args' to 'parameterArgs' to maintain consistency with the field naming and common Java conventions.
public static void updateParameters(Map<String, Object> parameter_args) {

src/main/java/simpaths/data/Parameters.java:266

  • [nitpick] Since the final modifier was removed from fields like MIN_START_YEAR, MAX_START_YEAR, and BASE_PRICE_YEAR to allow dynamic updates, consider renaming them using camelCase (e.g., minStartYear) to clarify that these values are mutable.
private static int MIN_START_YEAR = 2011; //Minimum allowed starting point. Should correspond to the oldest initial population.

@justin-ven justin-ven merged commit 320f43c into develop May 6, 2025
4 checks passed
@andrewbaxter439 andrewbaxter439 deleted the experimental/parameter_parsing branch January 21, 2026 15:37
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.

3 participants