Skip to content

Add Block.register_private_data_initializer()#3153

Merged
emma58 merged 1 commit intoPyomo:mainfrom
jsiirola:private-data-initializer
Feb 20, 2024
Merged

Add Block.register_private_data_initializer()#3153
emma58 merged 1 commit intoPyomo:mainfrom
jsiirola:private-data-initializer

Conversation

@jsiirola
Copy link
Copy Markdown
Member

Fixes # .

Summary/Motivation:

This provides a way for Block.private_data() to define a standard callback that should be used to initialize their private data attribute. The need for this became apparent when reviewing #3143.

Changes proposed in this PR:

  • add Block.register_private_data_initializer() for modules to define the callback to use to create their private data object.
  • add tests exercising this new functionality

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@jsiirola jsiirola requested a review from emma58 February 20, 2024 22:08
Copy link
Copy Markdown
Contributor

@emma58 emma58 left a comment

Choose a reason for hiding this comment

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

:)

@emma58 emma58 merged commit 9f0d7eb into Pyomo:main Feb 20, 2024
@jsiirola jsiirola deleted the private-data-initializer branch February 20, 2024 23:58
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