Skip to content

minimize/maximize crash on single-variable (1x1) QUBO inputs #49

@bernalde

Description

@bernalde

Summary

minimize and maximize throw on single-variable (1x1) QUBO inputs because the underlying ITensor DMRG solver does not support system sizes of 1.

Reproduction

On main (Julia 1.10):

using TenSolver
minimize(reshape([-2.0], 1, 1))

Result:

ERROR: `dmrg` currently does not support system sizes of 1. You can diagonalize
the MPO tensor directly with tools like `LinearAlgebra.eigen`, `KrylovKit.eigsolve`, etc.

Expected behavior

A one-variable QUBO is trivial to solve exactly: evaluate the objective at x = 0 and x = 1 and return the minimizer (or report degeneracy when the two are equal). minimize/maximize should return the correct energy and a Solution consistent with the multi-variable path, rather than crashing.

Notes

This edge case currently has ad hoc, slightly divergent fixes duplicated across several open PRs (#32, #33, #34, #41). It should be fixed once, on its own, so the other PRs can drop their copies and avoid merge conflicts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions