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:
- 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.).
- 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.
- 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
Part of the MQT QAO parity epic: JuliaQUBO/QUBO.jl#69
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) hasparse!methods only forVI,SAF{T},SQF{T}β nothing forScalarNonlinearFunction; grep forScalarNonlinearFunction/NLPBlockoversrc/anddocs/srcreturns zero hits.PreQUBOModeldeclares 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 plusquadratize!atsrc/compiler/build.jl:68-82with the residual-degree guard inoutput!at:100-114, and constraints already auto-setQuadratize(src/compiler/constraints.jl:535,613,635,735,757,823,938,978).Proposed change
Purely input-side work:
parse!methods forMOI.ScalarNonlinearFunctioninsrc/compiler/parse.jlthat walk+,-,*,^trees overVIintoPBO.PBF, erroring cleanly on non-polynomial heads (sin,/, etc.).PreQUBOModelβMOIU.@modelcannot list SNF, so add explicitMOI.supports/add_constraintmethods like the pair-specific overrides atprequbo.jl:38-96.Attributes.Quadratize()when parsed degree > 2.Note:
copy_toatsrc/wrapper.jl:88-94sets the objective on afull_bridge_optimizerwithout a supports check β verify the error/bridge path across supported MOI versions.Acceptance criteria
@objective(model, Min, x*y*z)) compiles and solves through ToQUBO with correct quadratized target model.Quadratizeis auto-enabled for degree > 2 input; tests assert final target degree β€ 2.Part of the MQT QAO parity epic: JuliaQUBO/QUBO.jl#69