Skip to content

Improved MindtPy Documentation#3

Open
tarikLG wants to merge 40 commits intomindtpy-docsfrom
polishing
Open

Improved MindtPy Documentation#3
tarikLG wants to merge 40 commits intomindtpy-docsfrom
polishing

Conversation

@tarikLG
Copy link
Copy Markdown
Owner

@tarikLG tarikLG commented Mar 3, 2026

Fixes # .

Summary/Motivation:

Improves code documentation and maintainability of the MindtPy solver package by enhancing docstrings to comply with Pyomo documentation standards. This PR adds comprehensive module-level documentation, refines function and method docstrings with NumPy-style formatting, and ensures consistency across the codebase.

Changes proposed in this PR:

  • Added module-level docstrings to all MindtPy package files (solver implementations, configuration, utilities, and tests)
  • Enhanced function and method docstrings with clear, imperative summaries and proper parameter/return documentation
  • Converted docstring formatting to NumPy style for consistency with Pyomo standards
  • Improved docstrings for:
    • Main solver interface methods (MindtPy.py)
    • Base algorithm class and all handler methods (algorithm_base_class.py)
    • Configuration helper functions (config_options.py)
    • Cut generation functions (cut_generation.py)
    • Strategy-specific implementations (OA, ECP, FP, GOA)
    • Callback machinery (single_tree.py, tabu_list.py)
    • Utility functions (util.py)
    • All test model classes and test helper functions
  • Refined language to use imperative verbs (e.g., "Generate...", "Add...", "Handle...") instead of descriptive phrases
  • Added type annotations and parameter descriptions throughout

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.

chudling and others added 23 commits February 24, 2026 15:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Tarik Levent Guler <64302098+tarikLG@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

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

Copilot reviewed 40 out of 40 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

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

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bernalde bernalde changed the base branch from main to mindtpy-docs March 25, 2026 21:06
Copy link
Copy Markdown
Collaborator

@bernalde bernalde left a comment

Choose a reason for hiding this comment

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

Good PR, I left a number of comments. Please address them and answer each one of them. Do not mark them as resolved as I will later look at them during the follow-up revision. Even if you find them unreasonable, do not just ignore them

@@ -75,4 +93,5 @@ def add_cuts(
)

def MindtPy_iteration_loop(self):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't it be specific to the feaspump?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

By this, I mean change the function name


Call after solve fixed NLP subproblem.
Use the optimal primal bound of the relaxed problem to update the dual bound.
Call after solving a primal-feasible subproblem (typically fixed NLP).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Again, can this ever be a non-NLP?

tarikLG and others added 3 commits April 5, 2026 19:16
Co-authored-by: David Bernal <dbernaln@purdue.edu>
Standardizes test model naming conventions for clarity and Python style,
renaming MINLP example files and classes to lowercase and CamelCase
formats. Removes redundant legacy test models, updates imports and
references throughout the MindtPy test framework, and adds minor docstring
improvements for better documentation consistency. Enhances maintainability
by enforcing backward-compatible aliases where necessary and clarifying
test model purposes.

No functional solver logic is changed; only test model structure and
integration are affected.
Corrects the indentation of class alias definitions to be outside the class scope, ensuring proper aliasing and adherence to Python conventions. No functional changes introduced.
Copy link
Copy Markdown

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 14 to 16

from pyomo.environ import Var, Integers, ConcreteModel, Integers
from pyomo.contrib.mindtpy.algorithm_base_class import _MindtPyAlgorithm
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The from pyomo.environ import ... statement imports Integers twice. This is redundant and may trip some linters; please remove the duplicate name from the import list.

Copilot uses AI. Check for mistakes.
@tarikLG tarikLG requested a review from bernalde April 8, 2026 17:52


# Backward-compatible alias.
SimpleMINLP = MinlpSimple
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think we need these aliases. Let's remove them by checking tests across the whole pyomo to avoid breaking things elsewhere

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I've gotten rid of the aliases

@@ -474,6 +524,13 @@ def build_ordered_component_lists(self, model):
)

def add_cuts_components(self, model):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add_cut_and_feas_components

@@ -75,4 +93,5 @@ def add_cuts(
)

def MindtPy_iteration_loop(self):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

By this, I mean change the function name

tarikLG and others added 6 commits April 11, 2026 18:34
…tyPump2; enhance add_orthogonality_cuts function with lazy initialization of cut containers.
…d MinlpSimple classes in test files.

Rename test model classes for consistency

Updates test model class names to standardize naming conventions
across test files, improving clarity and consistency. Removes
backward-compatible aliases as part of the cleanup.
Merge main into polishing
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.

6 participants