Skip to content

Parse MOI.ScalarNonlinearFunction polynomials for HUBO/PUBO objectives and constraintsΒ #224

Description

@bernalde

Motivation

MQT QAO (arXiv:2406.12840, Sec IV-E) accepts arbitrary-degree sympy polynomial objectives, funnels them into a qubovert PUBO, and reduces degree at solve time (src/mqt/qao/problem.py:51-102, solvers.py:102-103); its XOR penalty is natively cubic (constraints.py:630-671). ToQUBO cannot accept degree-3+ input even though its internal machinery handles arbitrary degree.

Current state

src/compiler/parse.jl (186 lines) has parse! methods only for VI, SAF{T}, SQF{T} β€” nothing for ScalarNonlinearFunction; grep for ScalarNonlinearFunction/NLPBlock over src/ and docs/src returns zero hits. PreQUBOModel declares only VI/SAF/SQF scalar functions (src/model/prequbo.jl:10-34), so SNF support is false. Meanwhile the arbitrary-degree machinery already exists: PBF IR plus quadratize! at src/compiler/build.jl:68-82 with the residual-degree guard in output! at :100-114, and constraints already auto-set Quadratize (src/compiler/constraints.jl:535,613,635,735,757,823,938,978).

Proposed change

Purely input-side work:

  1. Add parse! methods for MOI.ScalarNonlinearFunction in src/compiler/parse.jl that walk +, -, *, ^ trees over VI into PBO.PBF, erroring cleanly on non-polynomial heads (sin, /, etc.).
  2. Declare SNF objective/constraint support alongside PreQUBOModel β€” MOIU.@model cannot list SNF, so add explicit MOI.supports/add_constraint methods like the pair-specific overrides at prequbo.jl:38-96.
  3. Set Attributes.Quadratize() when parsed degree > 2.

Note: copy_to at src/wrapper.jl:88-94 sets the objective on a full_bridge_optimizer without a supports check β€” verify the error/bridge path across supported MOI versions.

Acceptance criteria

  • A cubic JuMP objective (e.g. @objective(model, Min, x*y*z)) compiles and solves through ToQUBO with correct quadratized target model.
  • Degree-3+ polynomial equality/inequality constraints compile.
  • Non-polynomial SNF heads produce a descriptive error naming the offending operator.
  • Quadratize is auto-enabled for degree > 2 input; tests assert final target degree ≀ 2.

Part of the MQT QAO parity epic: JuliaQUBO/QUBO.jl#69

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions