Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spectrum fails to find isolated zeros #153

Open
vasdommes opened this issue Nov 21, 2023 · 2 comments
Open

spectrum fails to find isolated zeros #153

vasdommes opened this issue Nov 21, 2023 · 2 comments
Assignees
Milestone

Comments

@vasdommes
Copy link
Collaborator

vasdommes commented Nov 21, 2023

Repro

The problem

Consider the problem:
maximize -y s.t. 1+x^4 + y(x^4/12 + x^2) >= 0 for all x>=2, and for x=2/3, x=4/3

It has solution y = -2.038. With this value, the polynomial has two zeros, x = 0.823 and x = 4/3.
Zero at 4/3 corresponds to a saturated positivity constraint, so spectrum should find it, but fails.

image

Generate SDP

This Mathematica code generates PVM input for the above problem (you may replace test/data/end-to-end_tests/1d-isolated-zeros/bin and test/out/end-to-end_tests/1d-isolated-zeros/bin/ with your folder):

SetDirectory@NotebookDirectory[];
<<"mathematica/SDPB.m";
Module[
 {
  pols = {
    PositiveMatrixWithPrefactor[
     DampedRational[1, {}, 1/E, x],
     {{{1 + x^4, x^4/12 + x^2}}} /. x -> x + 2
     ],
    PositiveMatrixWithPrefactor[
     DampedRational[1, {}, 1/E, x],
     {{{1 + x^4, x^4/12 + x^2}}} /. x -> 2/3
     ],
    PositiveMatrixWithPrefactor[
     DampedRational[1, {}, 1/E, x],
     {{{1 + x^4, x^4/12 + x^2}}} /. x -> 4/3
     ]
    },
  norm = {1, 0},
  obj = {0, -1}
  },
 WriteBootstrapSDP["test/data/end-to-end_tests/1d-isolated-zeros/pvm.xml", SDP[obj, norm, pols]]
 ]

Run spectrum

Run pvm2sdp, spdb and spectrum:

mpirun -n 1  build/pvm2sdp bin 768 test/data/end-to-end_tests/1d-isolated-zeros/pvm.xml test/out/end-to-end_tests/1d-isolated-zeros/bin/sdp.zip

mpirun -n 1  build/sdpb --checkpointInterval 3600 --maxRuntime 1340 --dualityGapThreshold 1.0e-30 --primalErrorThreshold 1.0e-30 --dualErrorThreshold 1.0e-30 --initialMatrixScalePrimal 1.0e20 --initialMatrixScaleDual 1.0e20 --feasibleCenteringParameter 0.1 --infeasibleCenteringParameter 0.3 --stepLengthReduction 0.7 --maxComplementarity 1.0e100 --maxIterations 1000 --verbosity 1 --procGranularity 1 --writeSolution x,y  --checkpointDir=test/out/end-to-end_tests/1d-isolated-zeros/bin/ck --outDir=test/out/end-to-end_tests/1d-isolated-zeros/bin/out --precision=768 --procsPerNode=1 --sdpDir=test/out/end-to-end_tests/1d-isolated-zeros/bin/sdp.zip

mpirun -n 1  build/spectrum  --format=PVM --input=test/data/end-to-end_tests/1d-isolated-zeros/pvm.xml --output=test/out/end-to-end_tests/1d-isolated-zeros/bin/spectrum.json --precision=768 --solution=test/out/end-to-end_tests/1d-isolated-zeros/bin/out --threshold=1e-10

Output spectrum.json should contain a zero at 4/3 for the third block, but it doesn't:

[
  {
    "zeros":
      [
      ],
    "error": "1.0562524597360583337573069506108746335315451887655830574165928895340864631033674112019596635496141058212641250675937499562542133584960258556025956504667784309160337632078674204256901869415481801704638694677768425245544266979804121507e-30"
  },
  {
    "zeros":
      [
      ],
    "error": "2.095731219614796108403644916691961569628769586161190798909263556734475250735374092554378010868024452879644779179134897687101936373532115722952718724068957113539240939763253896007982570257798949218397185511285978606975217990023424953e-30"
  },
  {
    "zeros":
      [
      ],
    "error": "0.48991935483870967741935483870873239717071607179703074516625492115066921878322723123658867648246469430121912667532024803889317061789256294639626253051508541414819586805959820018744516901258235728395112924931889854904825444993731832109"
  }
]
@davidsd
Copy link
Owner

davidsd commented Nov 21, 2023 via email

@vasdommes
Copy link
Collaborator Author

Only the zero at 4/3 corresponds to a saturated positivity constraint, so spectrum should only find that one.

Thanks, updated issue description

@vasdommes vasdommes modified the milestones: 3.0.0, 3.1.0 Mar 22, 2024
vasdommes added a commit that referenced this issue Oct 5, 2024
…find isolated zeros

Fixes #153
(actually fixed by 0284a52, tests added in 6177af3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants