Skip to content

Refactor: extract shared logic, split large files, deduplicate readers#1

Open
napinoco wants to merge 1 commit into
masterfrom
claude/refactoring-necessity-assessment-8czd0j
Open

Refactor: extract shared logic, split large files, deduplicate readers#1
napinoco wants to merge 1 commit into
masterfrom
claude/refactoring-necessity-assessment-8czd0j

Conversation

@napinoco

@napinoco napinoco commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Phase 1 - Solver pipeline extraction:

  • New solvePOPpipeline.m consolidates BBPOPtoCOP + solveCOP setup
    shared by solvePOParrow, solvePOPchordal, solvePOPdense (~30 lines each)

Phase 2 - genPOPchordal.m decomposition (528 → ~60 lines):

  • findChordalCliques.m: Cholesky-based maximal clique finder (renamed from
    private genCliques to avoid conflict with relaxation/genCliques.m)
  • generateSparseGraph.m: sensor network graph generator with computeDistance2
    as a local helper

Phase 3 - BBPOPtoCOP.m decomposition (378 → ~150 lines):

  • genPolyCone.m: polynomial cone generation pipeline
  • addSlack.m: slack variable insertion for Lagrangian-DNN
  • findCommonMonos.m: unique monomial collection across moment/poly structures
  • Removed dead code: estimateUbdIX (superseded by estimateUbdIXpd)

Phase 4 - Common file reader + deprecation fix:

  • util/readInstanceFile.m: unified fopen/fscanf/fclose/sscanf pattern
  • Applied to qapread, qapreadBP, qapreadnal, biqread
  • Replaced deprecated findstr with strfind in qapreadnal and biqread

https://claude.ai/code/session_01HNNcizLCaDBSx3xHWoTD3F

Phase 1 - Solver pipeline extraction:
  - New solvePOPpipeline.m consolidates BBPOPtoCOP + solveCOP setup
    shared by solvePOParrow, solvePOPchordal, solvePOPdense (~30 lines each)

Phase 2 - genPOPchordal.m decomposition (528 → ~60 lines):
  - findChordalCliques.m: Cholesky-based maximal clique finder (renamed from
    private genCliques to avoid conflict with relaxation/genCliques.m)
  - generateSparseGraph.m: sensor network graph generator with computeDistance2
    as a local helper

Phase 3 - BBPOPtoCOP.m decomposition (378 → ~150 lines):
  - genPolyCone.m: polynomial cone generation pipeline
  - addSlack.m: slack variable insertion for Lagrangian-DNN
  - findCommonMonos.m: unique monomial collection across moment/poly structures
  - Removed dead code: estimateUbdIX (superseded by estimateUbdIXpd)

Phase 4 - Common file reader + deprecation fix:
  - util/readInstanceFile.m: unified fopen/fscanf/fclose/sscanf pattern
  - Applied to qapread, qapreadBP, qapreadnal, biqread
  - Replaced deprecated findstr with strfind in qapreadnal and biqread

https://claude.ai/code/session_01HNNcizLCaDBSx3xHWoTD3F
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.

2 participants