Skip to content

[WIP] Update docstrings for physics-inspired algorithms#105

Merged
Anselmoo merged 4 commits intomainfrom
copilot/update-optimizer-docstrings-physics
Dec 24, 2025
Merged

[WIP] Update docstrings for physics-inspired algorithms#105
Anselmoo merged 4 commits intomainfrom
copilot/update-optimizer-docstrings-physics

Conversation

Copy link
Contributor

Copilot AI commented Dec 23, 2025

Update Optimizer Docstrings - Physics-Inspired Category (4 files) ✅ COMPLETE

All Tasks Completed ✅

  • Complete gravitational_search.py docstring (GSA - Newton's gravity laws)
  • Complete equilibrium_optimizer.py docstring (EO - Mass balance equilibrium)
  • Complete atom_search.py docstring (ASO - Molecular dynamics)
  • Complete rime_optimizer.py docstring (RIME - Ice formation physics)
  • Add seed parameter support to atom_search.py and rime_optimizer.py (BBOB requirement)
  • Run linting: uv run ruff check opt/physics_inspired/
  • Validate all changes with test runs
  • Category validation passes
  • Fix linting issues (RUF002 warnings)
  • Expand parameter descriptions in hyperparameter tables

Acceptance Criteria ✅

  • All 4 files completed with COCO/BBOB compliance
  • All pass uv run ruff check opt/physics_inspired/ (0 errors)
  • Physics analogies clearly explained in mathematical formulation
  • Category validation passes

Latest Changes (Dec 24, 2025)

Fixed Linting Issues:

  • Replaced × with $\times$ LaTeX notation in Complexity metadata field (all 4 files)
  • Replaced × with $\times$ in BBOB budget usage notes (all 4 files)
  • All RUF002 warnings resolved ✅

Enhanced Descriptions:
Expanded hyperparameter table descriptions from terse to comprehensive:

Before: Number of agents (solutions)
After: Number of agents (candidate solutions) in population

Before: Maximum iterations
After: Maximum number of iterations for optimization

Before: Generation rate control
After: Generation rate control constant (controls magnitude)

Summary

Physics-Inspired Category: 4/4 files complete (100%)

All files now include:

  • Complete Algorithm Metadata with year, authors, complexity, properties
  • Mathematical formulation with LaTeX emphasizing physics analogies
  • Hyperparameters with BBOB recommendations and detailed descriptions
  • Complete Args/Attributes/Methods sections
  • References with DOI links
  • BBOB performance characteristics

Physics Analogies Emphasized:

  1. GSA: Newton's gravitational forces with mass-fitness relationship
  2. EO: Control volume mass balance reaching equilibrium
  3. ASO: Lennard-Jones molecular potential (attraction/repulsion)
  4. RIME: Ice formation phases (soft-rime exploration, hard-rime exploitation)

BBOB Compliance:

  • ✅ Seed parameter added to ASO and RIME
  • ✅ All use np.random.default_rng(self.seed)
  • ✅ Examples include seed=42
  • ✅ Standard BBOB dimensions documented

Validation:

  • 0 linting errors (all RUF002 warnings fixed with LaTeX)
  • ✅ All optimizers tested and working
  • ✅ No FIXME markers remaining
  • ✅ Parameter descriptions expanded and clarified
Original prompt

This section details on the original issue you should resolve

<issue_title>Update Optimizer Docstrings - Physics-Inspired Category (4 files)</issue_title>
<issue_description>## Problem
4 physics-inspired algorithms lack COCO/BBOB compliant docstrings.

Files to Update

Implementation

Follow template emphasizing physics analogies (gravity, equilibrium, atomic forces).

Acceptance Criteria

  • All 4 files completed with COCO/BBOB compliance
  • All pass uv run ruff check opt/physics_inspired/
  • Physics analogies clearly explained in mathematical formulation
  • Category validation passes

Complexity

Low - Small category with clear physics-based metaphors

Dependencies

Depends on: #4 (validation checkpoint includes gravitational_search)</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 23, 2025
Co-authored-by: Anselmoo <13209783+Anselmoo@users.noreply.github.com>
Copy link
Owner

@Anselmoo Anselmoo left a comment

Choose a reason for hiding this comment

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

@copilot please fix the linting issues and some descriptions are quite short

…n physics-inspired optimizers

Co-authored-by: Anselmoo <13209783+Anselmoo@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 24, 2025

@copilot please fix the linting issues and some descriptions are quite short

Fixed in commit b934eb1:

Linting issues resolved:

  • Replaced × with $\times$ LaTeX notation in Complexity field and budget usage notes
  • All files now pass uv run ruff check opt/physics_inspired/ with 0 errors

Parameter descriptions expanded:

  • Changed "Number of agents (solutions)" → "Number of agents (candidate solutions) in population"
  • Changed "Maximum iterations" → "Maximum number of iterations for optimization"
  • Changed "Generation rate control" → "Generation rate control constant (controls magnitude)"
  • Similar expansions applied to all hyperparameter descriptions across all 4 files

All optimizers tested and working correctly.

Copilot AI requested a review from Anselmoo December 24, 2025 07:04
@Anselmoo Anselmoo marked this pull request as ready for review December 24, 2025 07:14
Copilot AI review requested due to automatic review settings December 24, 2025 07:14
@Anselmoo Anselmoo merged commit 8fb81b4 into main Dec 24, 2025
2 of 5 checks passed
Copy link
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 completes the COCO/BBOB compliant docstring updates for all 4 physics-inspired optimization algorithms. The work adds comprehensive documentation following the COCO/BBOB template, fixes linting issues by replacing unicode symbols with LaTeX notation, and adds required seed parameter support for reproducibility.

Key changes:

  • Added complete algorithm metadata, mathematical formulations, and BBOB performance characteristics for all 4 algorithms
  • Enhanced parameter descriptions from terse to comprehensive format
  • Fixed all RUF002 linting warnings by replacing × with $\times$ LaTeX notation
  • Added seed parameter to ASO and RIME algorithms for BBOB compliance

Reviewed changes

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

File Description
opt/physics_inspired/rime_optimizer.py Complete RIME docstring with ice formation physics model, added seed parameter, expanded hyperparameter descriptions, fixed LaTeX notation
opt/physics_inspired/gravitational_search.py Complete GSA docstring emphasizing Newton's gravity laws, mass-fitness relationship, expanded parameter descriptions with detailed physics explanations
opt/physics_inspired/equilibrium_optimizer.py Complete EO docstring with mass balance equilibrium physics, control volume formulation, comprehensive parameter documentation
opt/physics_inspired/atom_search.py Complete ASO docstring with Lennard-Jones molecular dynamics, added seed parameter, detailed force calculation explanations

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Optimizer Docstrings - Physics-Inspired Category (4 files)

2 participants

Comments