Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Comments

Draft: Adding Sampling Bounds and Random Number Generators#2

Draft
gdelato2 wants to merge 1 commit intoappliedcomputingtech:mainfrom
gdelato2:Sampling-Bounds-and-Random-Number-Generators
Draft

Draft: Adding Sampling Bounds and Random Number Generators#2
gdelato2 wants to merge 1 commit intoappliedcomputingtech:mainfrom
gdelato2:Sampling-Bounds-and-Random-Number-Generators

Conversation

@gdelato2
Copy link

Summary of changes:

  1. Modified pro_gym\utils\utils.py generate_random_actions
  • action space is parsed for any specified ranges; defaults to using init_val and random_range
  • the addition of an optional random_numbers input; allows for external random number generators
  • checks for random_numbers validity
  • random_numbers are generated before the loop and are deleted as they are used
  1. Added pro_gym\utils\utils.py generate_batch_actions
  • function to generate a batch of actions
  • calls generate_random_actions in a loop, uses the optional random_numbers input
  • multiple options for random number generators
  1. Added pro_gym\utils\utils.py sample_random_value
  • simple helper function that generates parameter values from random numbers
  • default to delete the random number once it is used
  1. Modified pro_gym\examples data_generator:
  • accepts an addition parameter to select the random number generator
  • uses generate_batch_actions if LHS or Sobol generator is selected
  1. Added pro_gym\examples\config natural_gas_proc_ranges.yaml
  • used for testing new features

Working on/Issues:

  1. Some testing and cleanup and comments
  2. DWSIM crashes after a few samples. I am looking into whether it is my installation/environment or something else

Added: natural_gas_proc_ranges.yaml to test new features
Changed: data_generator.py can now sample with lhs and sobol methods
Changed: utils.py modified to allow batch sampling, can sample with lhs and sobol methods
@gdelato2 gdelato2 marked this pull request as draft December 12, 2024 16:23
@gdelato2
Copy link
Author

More on DWSIM crashing:

Restored to main for testing

  • The crash happens on line 78 in pro_gym/envs/dwsim_env.py when the simulation is restored to its original state.
  • Occurs after a few samples have been completed (~4)
  • Crash also occurs if GetSnapshot and RestoreSnapshot methods are used to return the simulation to its original state.
  • Reloading the simulation after each sample was the only way I was able to get more than ten samples out (self.sim = self.interf.LoadFlowsheet(path))
  • Reloading simulation adds a few seconds per sample

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant