Fix QUBO DMRG LAPACK stability#34
Conversation
bernalde
left a comment
There was a problem hiding this comment.
No blocking issues found. The PR addresses issue #1 by making the QUBO DMRG path use a stable default minimum bond dimension and by handling one-site QUBOs without calling ITensor DMRG, which does not support that case.
Tests reviewed:
- JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using TenSolver; cases = Any[(reshape([-2.0], 1, 1), -2.0, [1]), (reshape([2.0], 1, 1), 0.0, [0]), (reshape([0.0], 1, 1), 0.0, nothing)]; for (Q, expected, sample_expected) in cases; E, psi = minimize(Q; verbosity=0); @Assert E ≈ expected; if sample_expected !== nothing; @Assert TenSolver.sample(psi) == sample_expected; else; @Assert [0] in psi && [1] in psi; end; end; println("one-site Float64 cases passed")'
- JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using Test, LinearAlgebra, TenSolver; include("test/cases/vrp.jl")'
- JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using Pkg; Pkg.test("TenSolver")'
- JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using TenSolver; Q = reshape([-2], 1, 1); E, psi = minimize(Q; verbosity=0); @Assert E == -2; @Assert TenSolver.sample(psi) == [1]; println("one-site Int case passed")'
CI reviewed with gh pr checks --watch --fail-fast: all checks passed across Julia 1, lts, and pre on Ubuntu, macOS, and Windows, plus docs.
|
That error was unrelated to the It is (most probably) dependent on this issue being fixed: The exact one-variable solve path is good to have! But I'd prefer it to be a separate method for better organization. |
Summary
mindimto2for both the direct solver and JuMP optimizer path, so the VRP QUBO regression no longer needs a caller-provided workaround.Tests run
JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using TenSolver; E, psi = minimize(reshape([-2.0], 1, 1); verbosity=0); @assert E ≈ -2.0; @assert TenSolver.sample(psi) == [1]; @assert [1] in psi; @assert !([0] in psi); println("single-variable minimize passed")'single-variable minimize passed).JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using Test, LinearAlgebra, TenSolver; include("test/cases/vrp.jl")'Vehicle Routing Problem (VRP) | 2 passed).JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using Pkg; Pkg.test("TenSolver")'Testing TenSolver tests passed).Notes
Manifest.tomlfiles resolved for Julia 1.12.6; resolving in/tmp/tensolver-test-envmatches the repository's documented CI-style package test path without modifying repository files.Closes #1