Skip to content

Remove objective-direction compatibility shims and enforce canonical energy semantics - #59

Closed
fgfuchs with Copilot wants to merge 8 commits into
copilot/implement-objective-direction-migrationfrom
copilot/copilotimplement-objective-direction-migration
Closed

Remove objective-direction compatibility shims and enforce canonical energy semantics#59
fgfuchs with Copilot wants to merge 8 commits into
copilot/implement-objective-direction-migrationfrom
copilot/copilotimplement-objective-direction-migration

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

This PR completes the objective-direction migration as a clean break: deprecated compatibility APIs and alias fields are removed, and the codebase now exposes a single canonical invariant based on objective_sense, objective_value(...), and energy(...). QAOA internals remain energy-first and argmin-based throughout optimization, statistics, warm-starting, post-processing, and serialization.

  • API cleanup

    • Remove deprecated compatibility methods:
      • Problem.cost()
      • Problem.computeMinMaxCosts()
      • QAOA.get_Exp()
    • Remove legacy result/landscape alias fields that duplicated canonical energy-named fields.
    • Update tests and docs to use the canonical API only.
  • Canonical objective/energy semantics

    • Keep one invariant across the codebase:
      • energy(x) = objective_value(x) for minimize problems
      • energy(x) = -objective_value(x) for maximize problems
    • Remove fallback/adapter logic that preserved old sign conventions.
    • Keep warm-start selection, CVaR/statistics, best-solution tracking, and post-processing energy-native.
  • QAOA internals

    • Rename internal grid-search/evaluation paths to energy terminology.
    • Keep landscape sampling and depth expansion strictly based on minimizing energy.
    • Remove compatibility aliases from post-processed and sampled results.
  • Serialization / schema

    • Keep serialized payloads on canonical objective/energy semantics only.
    • Bump qaoaIO schema to 3.
    • Reject legacy payloads instead of silently adapting old compatibility shapes.
  • Docs / examples / migration surface

    • Remove backward-compatibility language from the README.
    • Document the clean-break API explicitly:
      • objective_value(...)
      • energy(...)
      • objective_bounds()
      • get_energy()
      • get_objective()
    • Update example notebooks and fixture data to the canonical API.

Example of the resulting API:

value = problem.objective_value(bitstring)
energy = problem.energy(bitstring)

best_energy = qaoa.get_energy(depth=1)
best_objective = qaoa.get_objective(depth=1)

Copilot AI changed the title [WIP] Remove backward-compatibility shims in objective-direction migration Remove objective-direction compatibility shims and enforce canonical energy semantics Jul 31, 2026
Copilot AI requested a review from fgfuchs July 31, 2026 12:05

@fgfuchs fgfuchs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is jsut to updat ethe branch

@fgfuchs
fgfuchs marked this pull request as ready for review July 31, 2026 12:12
@fgfuchs
fgfuchs self-requested a review July 31, 2026 12:13
@fgfuchs fgfuchs closed this Aug 4, 2026
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