Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Set qcp to True for cvxpy Problem.solve in qp_solver #1083

Merged
merged 2 commits into from
Jun 30, 2020

Conversation

mtreinish
Copy link
Contributor

Summary

The legacy tutorial in the Qiskit/qiskit-tutorials repo for running
QSVM classification is failing with newer versions of aqua that use
cvxpy. The error message returned suggests setting the qcp flag to true
on solve(). This treats the problem as disciplined quasiconvex program
instead of a disciplined convex program and seems to avoid the hard
failure in the tutorial.

Details and comments

Fixes Qiskit/qiskit-tutorials#928

The legacy tutorial in the Qiskit/qiskit-tutorials repo for running
QSVM classification is failing with newer versions of aqua that use
cvxpy. The error message returned suggests setting the qcp flag to true
on solve(). This treats the problem as disciplined quasiconvex program
instead of a disciplined convex program and seems to avoid the hard
failure in the tutorial.

Fixes: Qiskit/qiskit-tutorials#928
@woodsp-ibm woodsp-ibm added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Jun 30, 2020
@manoelmarques manoelmarques merged commit 5312359 into qiskit-community:master Jun 30, 2020
@rraymondhp
Copy link

Does this really solve the issue? I tried to set the qcp=True but it does not work. And gave another error as below:

~/miniconda3/envs/qiskit_keio/lib/python3.6/site-packages/qiskit/aqua/utils/qp_solver.py in optimize_svm(kernel_matrix, y, scaling, max_iters, show_progress)
     79         [G@x <= h,
     80          A@x == b])
---> 81     prob.solve(verbose=show_progress,qcp=True)
     82     result = np.asarray(x.value).reshape((n, 1))
     83     alpha = result * scaling

~/miniconda3/envs/qiskit_keio/lib/python3.6/site-packages/cvxpy/problems/problem.py in solve(self, *args, **kwargs)
    393         else:
    394             solve_func = Problem._solve
--> 395         return solve_func(self, *args, **kwargs)
    396 
    397     @classmethod

~/miniconda3/envs/qiskit_keio/lib/python3.6/site-packages/cvxpy/problems/problem.py in _solve(self, solver, warm_start, verbose, gp, qcp, requires_grad, enforce_dpp, **kwargs)
    731             if qcp and not self.is_dcp():
    732                 if not self.is_dqcp():
--> 733                     raise error.DQCPError("The problem is not DQCP.")
    734                 reductions = [dqcp2dcp.Dqcp2Dcp()]
    735                 if type(self.objective) == Maximize:

DQCPError: The problem is not DQCP.

@t-imamichi
Copy link
Contributor

An issue is posted again. Qiskit/qiskit-tutorials#932

@woodsp-ibm
Copy link
Member

@rraymondhp As you have seen there is still a problem that this did not take care of. Someone else contacted me directly noting the above. We briefly looked at it and in the meanwhile, since they wanted to move forwards, I suggested they might go back to 0.7.1 where cvxopt was still being used.

manoelmarques pushed a commit to manoelmarques/qiskit-aqua that referenced this pull request Jul 28, 2020
…y#1083)

The legacy tutorial in the Qiskit/qiskit-tutorials repo for running
QSVM classification is failing with newer versions of aqua that use
cvxpy. The error message returned suggests setting the qcp flag to true
on solve(). This treats the problem as disciplined quasiconvex program
instead of a disciplined convex program and seems to avoid the hard
failure in the tutorial.

Fixes: Qiskit/qiskit-tutorials#928
pbark pushed a commit to pbark/qiskit-aqua that referenced this pull request Sep 16, 2020
…y#1083)

The legacy tutorial in the Qiskit/qiskit-tutorials repo for running
QSVM classification is failing with newer versions of aqua that use
cvxpy. The error message returned suggests setting the qcp flag to true
on solve(). This treats the problem as disciplined quasiconvex program
instead of a disciplined convex program and seems to avoid the hard
failure in the tutorial.

Fixes: Qiskit/qiskit-tutorials#928
manoelmarques pushed a commit to qiskit-community/qiskit-machine-learning that referenced this pull request Feb 27, 2021
…y/qiskit-aqua#1083)

The legacy tutorial in the Qiskit/qiskit-tutorials repo for running
QSVM classification is failing with newer versions of aqua that use
cvxpy. The error message returned suggests setting the qcp flag to true
on solve(). This treats the problem as disciplined quasiconvex program
instead of a disciplined convex program and seems to avoid the hard
failure in the tutorial.

Fixes: Qiskit/qiskit-tutorials#928
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DCP Error when running QSVM-classification Aqua tutorial #204
5 participants