Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 21, 2025

Motivation

The allocation documentation needed comprehensive updates to address developer
documentation gaps and improve technical clarity after the recent MOA.jl integration
(PR #2522).

Key Issues Addressed:

  1. Mathematical-Code Disconnect: High-level mathematical formulation didn't explain
    how it translates to actual JuMP implementation
  2. Lost Technical Content: ~104 lines of commented out detailed technical content are properly
    reorganized
  3. Documentation inconsistencies: Minor notation issues and TODO comments needed
    cleanup
  4. Missing MOA.jl documentation: Recent architectural changes weren't properly
    documented

Solution

This PR creates comprehensive technical documentation that bridges the gap between
mathematical formulation and code implementation:

New Technical Reference Document

  • Added: docs/dev/allocation-technical-reference.qmd - Complete developer guide
    (1,360+ lines)
  • Comprehensive coverage: Optimization variables, constraints, objectives, basin
    profiles, and demand processing
  • Implementation bridge: Direct translations from mathematical formulations to JuMP
  • MOA.jl code
  • Developer tools: Debugging guide with concrete code examples for common
    allocation issues

Bridged Math-Code Gap

  • Direct mapping: Examples like F_ij ≤ (C_S)_ijJuMP.@constraint(problem, flow[link] <= capacity[link])
  • MOA.jl integration: Complete documentation of lexicographic goal programming
    implementation
  • Two-phase approach: Documented placeholder initialization → real value updates
    process
  • Linear programming focus: Updated formulations to reflect actual linear (not
    quadratic) objectives

Recovered Technical Content

  • Systematically extracted: All 104 lines of previously commented technical content
  • Proper organization: Relocated detailed mathematical formulations to technical
    reference
  • Enhanced coverage: Basin profile handling, demand type processing, and constraint
    implementations
  • Preserved knowledge: Critical implementation details now properly documented

Documentation Cleanup

  • Notation consistency: Fixed mixed Q/F usage for flow variables throughout
  • Removed TODO comments: Cleared outdated placeholder comments and incomplete
    sections
  • Mathematical clarity: Improved variable definitions, equation formatting, and
    terminology
  • Cross-references: Added strategic links between concept and technical
    documentation

MOA.jl Integration Documentation

  • Architecture coverage: Complete lexicographic goal programming implementation
  • Code examples: Actual MOA.Optimizer(get_optimizer()) initialization patterns
  • Linear objectives: Documented JuMP.@objective(problem, Min, objectives.objective_expressions_all) approach
  • Multi-objective workflow: Two-phase optimization process with MOA.jl
    orchestration

Key Changes

Files Modified:

-Created: docs/dev/allocation-technical-reference.qmd - Complete technical
reference (1,360 lines)
-Updated: docs/concept/allocation.qmd - Cleaned notation, removed TODOs,
added MOA.jl references
-Removed: docs/dev/allocation.qmd - Eliminated redundant content
-Fixed: docs/_quarto.yml - Updated navigation to reference new technical
documentation

Visual Result

The new technical reference provides:

  • Complete table of contents covering all allocation system aspects
  • Mathematical formulations paired with actual JuMP + MOA.jl code implementations
  • Step-by-step explanations of the two-phase optimization process
  • Debugging guides and performance considerations for developers
  • Professional formatting with proper cross-references and code highlighting

Verification

  • Documentation builds successfully with Quarto
  • Cross-references work correctly between all documentation files
  • Mathematical equations render properly with MathJax
  • No broken links - All references to moved/deleted files updated
  • Implementation accuracy confirmed - Documentation matches actual MOA.jl code

TODOS:

  1. #TODO: Add model image with primary network and secondary networks
  2. #TODO: Add image with which links are assumed to be part of the subnetwork

Copilot AI changed the title [WIP] Update allocation technical documentation and developer reference Add comprehensive allocation technical reference documentation Jul 21, 2025
Copilot AI requested a review from jarsarasty July 21, 2025 13:34
Copilot finished work on behalf of jarsarasty July 21, 2025 13:34
@jarsarasty
Copy link
Collaborator

Hi @simulutions,

In #2479, you are nicely updating the allocation documentation and make it more accessible to users.

Copilot created this pull request to update and relocate the technical developer documentation on allocation. I updated the automatically generated PR description, which was inaccurate.

These changes should complement what you are currently doing in #2479.

@jarsarasty jarsarasty requested a review from simulutions July 24, 2025 16:54
d^{p_{\text{fd}}} \text{ if } p = p_{\text{fd}}
\end{cases}
$$
for all $i \in FD_S$. Here $d^{p_{\text{fd}}}$ is given by the original flow demand minus the flows through node $i$ at all priorities $p < p_{\text{fd}}$.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please explain what the subscripts fd and df mean

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a callout note explaining that the subscript "fd" stands for "flow demand", indicating the specific priority level associated with flow demand nodes in the subnetwork. Fixed in commit a07fe2c.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, @copilot

Comment on lines 564 to 568
**Implementation:**
```julia
get_subnetwork_ids(graph::MetaGraph, node_type::NodeType.T, subnetwork_id::Int32) =
filter(node_id -> node_id.type == node_type, graph[].node_ids[subnetwork_id])
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not. visible in the generated docs, can you fix that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed the code block visibility by using proper Quarto syntax with {.julia} language specification and ensuring proper spacing. The implementation code should now render correctly in the generated documentation. Fixed in commit a07fe2c.

Copilot AI requested a review from simulutions July 25, 2025 13:33
Copilot finished work on behalf of simulutions July 25, 2025 13:33
…ntegration

- Fix mathematical notation consistency throughout both allocation documentation files
- Ensure consistent use of F for flow variables (replaced mixed Q/F usage)
- Standardize mathematical operators and set notation (≠, ∀, proper quantifiers)
- Improve clarity of objective function formulations and error variable definitions
- Update technical reference with comprehensive MOA.jl implementation details
- Remove outdated TODO comments and placeholder content
- Consolidate redundant documentation into streamlined technical reference
- Verify consistency between documented math and actual linear programming implementation
- Fix Quarto config reference to new dev/allocation-technical-reference.qmd

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@jarsarasty jarsarasty force-pushed the copilot/fix-190cd6d8-2092-4f7d-941f-845a73753457 branch from 9d3c093 to 807457f Compare September 3, 2025 12:41
@jarsarasty
Copy link
Collaborator

The purpose of this branch was to track the technical implementation of allocation. This pull request can now be closed, as this part of the documentation is no longer required.

@jarsarasty jarsarasty closed this Oct 27, 2025
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