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

Commit

Permalink
Merge pull request #795 from manoelmarques/stable-0.6.3
Browse files Browse the repository at this point in the history
[Stable] Add install checks for cvxopt, torch, pyscf. Support python 3.8
  • Loading branch information
manoelmarques authored Jan 29, 2020
2 parents c041574 + 82dd573 commit a51f7db
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 124 deletions.
53 changes: 43 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -21,11 +21,10 @@ os: linux
dist: xenial

language: python
python: 3.6
python: 3.7

env:
global:
- DEPENDENCY_BRANCH=$(if [[ "$TRAVIS_BRANCH" == stable* ]]; then echo "stable"; else echo "master"; fi)
- INIT_FILE="$TRAVIS_BUILD_DIR/qiskit/__init__.py"

before_script:
Expand Down Expand Up @@ -94,28 +93,62 @@ before_script:
matrix:
include:
- name: "Lint and Style check and Test Chemistry"
env: TEST_DIR=chemistry
- name: "Lint and Style check and Test Chemistry Python 3.7"
if: tag IS blank
env:
- DEPENDENCY_BRANCH=$(if [[ "$TRAVIS_BRANCH" == stable* ]]; then echo "stable"; else echo "master"; fi)
- TEST_DIR=chemistry
script:
make spell && make style && make lint && export OPENBLAS_NUM_THREADS=1 && python -m unittest discover -v test/chemistry
- name: Test Chemistry Python 3.8"
if: tag IS blank
env:
- DEPENDENCY_BRANCH=master
- TEST_DIR=chemistry
python: 3.8
script:
make spell && make style && make lint && export OPENBLAS_NUM_THREADS=1 && stestr --test-path test/chemistry run
- name: "Test Aqua"
export OPENBLAS_NUM_THREADS=1 && python -m unittest discover -v test/chemistry
- name: "Test Aqua Python 3.7"
if: tag IS blank
env: DEPENDENCY_BRANCH=$(if [[ "$TRAVIS_BRANCH" == stable* ]]; then echo "stable"; else echo "master"; fi)
script: stestr --test-path test run --blacklist-file blacklist.txt
- name: "Test Aqua 2"
- name: "Test Aqua Python 3.8"
if: tag IS blank
python: 3.8
env: DEPENDENCY_BRANCH=master
script: stestr --test-path test run --blacklist-file blacklist.txt
- name: "Test Aqua 2 Python 3.7"
if: tag IS blank
env: DEPENDENCY_BRANCH=$(if [[ "$TRAVIS_BRANCH" == stable* ]]; then echo "stable"; else echo "master"; fi)
script: stestr --test-path test run --whitelist-file selection.txt
- name: "Test Aqua 2 Python 3.8"
if: tag IS blank
python: 3.8
env: DEPENDENCY_BRANCH=master
script: stestr --test-path test run --whitelist-file selection.txt
- name: "Test Aqua 3"
- name: "Test Aqua 3 Python 3.7"
if: tag IS blank
env: DEPENDENCY_BRANCH=$(if [[ "$TRAVIS_BRANCH" == stable* ]]; then echo "stable"; else echo "master"; fi)
script: stestr --test-path test run --whitelist-file selection2.txt
- name: "Test Aqua 3 Python 3.8"
if: tag IS blank
python: 3.8
env: DEPENDENCY_BRANCH=master
script: stestr --test-path test run --whitelist-file selection2.txt

- if: tag IS present
python: 3.6
env:
- TWINE_USERNAME=qiskit
- DEPENDENCY_BRANCH=$(if [[ "$TRAVIS_BRANCH" == stable* ]]; then echo "stable"; else echo "master"; fi)
install: pip install -U twine
script:
- python3 setup.py sdist bdist_wheel
- twine upload dist/qiskit*

before_install:
- pip install --upgrade pip setuptools wheel
- pip install -U 'pip<20.0.0'
- pip install -U setuptools wheel
- |
if [ -f $INIT_FILE ]; then
# stops travis if __init__.py exists under qiskit
Expand Down
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,24 @@ Changelog](http://keepachangelog.com/en/1.0.0/).
> - **Fixed**: for any bug fixes.
> - **Security**: in case of vulnerabilities.
[UNRELEASED](https://github.com/Qiskit/qiskit-aqua/compare/0.6.2...HEAD)
[UNRELEASED](https://github.com/Qiskit/qiskit-aqua/compare/0.6.3...HEAD)
========================================================================

[0.6.3](https://github.com/Qiskit/qiskit-aqua/compare/0.6.2...0.6.3) - 2020-01-29
=================================================================================

Changed
-------

- Add install checks for cvxopt, torch, pyscf. Add python 3.8 support. (#795)

Deprecated
----------

- Python 3.5 support in qiskit-aqua is deprecated. Support will be
removed on the upstream python community's end of life date for the version,
which is 09/13/2020.

[0.6.2](https://github.com/Qiskit/qiskit-aqua/compare/0.6.1...0.6.2) - 2019-12-17
=================================================================================

Expand Down
2 changes: 1 addition & 1 deletion qiskit/aqua/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.2
0.6.3
41 changes: 28 additions & 13 deletions qiskit/aqua/utils/qp_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -14,35 +14,50 @@

""" qp solver """

from typing import Optional, Tuple
import logging

import numpy as np
from cvxopt import matrix, solvers

logger = logging.getLogger(__name__)

_HAS_CVXOPT = False
try:
from cvxopt import matrix, solvers
_HAS_CVXOPT = True
except ImportError:
logger.info('CVXOPT is not installed. See http://cvxopt.org/install/index.html')


def optimize_svm(kernel_matrix, y, scaling=None, max_iters=500, show_progress=False):
def optimize_svm(kernel_matrix: np.ndarray,
y: np.ndarray,
scaling: Optional[float] = None,
max_iters: int = 500,
show_progress: bool = False) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
"""
Solving quadratic programming problem for SVM; thus, some constraints are fixed.
The notation is follows the equation here:
http://cvxopt.org/userguide/coneprog.html#quadratic-programming
Args:
kernel_matrix (numpy.ndarray): NxN array
y (numpy.ndarray): Nx1 array
scaling (float): the scaling factor to renormalize the `y`, if it is None,
use L2-norm of `y` for normalization
max_iters (int): number of iterations for QP solver
show_progress (bool): showing the progress of QP solver
kernel_matrix: NxN array
y: Nx1 array
scaling: the scaling factor to renormalize the `y`, if it is None,
use L2-norm of `y` for normalization
max_iters: number of iterations for QP solver
show_progress: showing the progress of QP solver
Returns:
numpy.ndarray: Sx1 array, where S is the number of supports
numpy.ndarray: Sx1 array, where S is the number of supports
numpy.ndarray: Sx1 array, where S is the number of supports
np.ndarray: Sx1 array, where S is the number of supports
np.ndarray: Sx1 array, where S is the number of supports
np.ndarray: Sx1 array, where S is the number of supports
Raises:
NameError: CVXOPT not installed.
"""
# pylint: disable=invalid-name
if not _HAS_CVXOPT:
raise NameError('CVXOPT is not installed. See http://cvxopt.org/install/index.html')
if y.ndim == 1:
y = y[:, np.newaxis]
H = np.outer(y, y) * kernel_matrix
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ sphinx-tabs>=1.1.11
sphinx-automodapi
matplotlib>=2.1
stestr>=2.5.0
torch; sys_platform == 'linux' or (python_version < '3.8' and sys_platform != 'win32')
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ numpy>=1.13
psutil>=5
jsonschema>=2.6
scikit-learn>=0.20.0
cvxopt
cvxopt; python_version < '3.8' or sys_platform != 'win32'
dlx
docplex
fastdtw
quandl
setuptools>=40.1.0
h5py
networkx>=2.2
pyscf; sys_platform != 'win32'
pyscf; sys_platform == 'linux' or (python_version < '3.8' and sys_platform != 'win32')
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -33,15 +33,15 @@
"psutil>=5",
"jsonschema>=2.6",
"scikit-learn>=0.20.0",
"cvxopt",
"cvxopt; python_version < '3.8' or sys_platform != 'win32'",
"dlx",
"docplex",
"fastdtw",
"quandl",
"setuptools>=40.1.0",
"h5py",
"networkx>=2.2",
"pyscf; sys_platform != 'win32'",
"pyscf; sys_platform == 'linux' or (python_version < '3.8' and sys_platform != 'win32')",
]

if not hasattr(setuptools, 'find_namespace_packages') or not inspect.ismethod(setuptools.find_namespace_packages):
Expand Down Expand Up @@ -71,9 +71,11 @@
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Scientific/Engineering"
),
keywords='qiskit sdk quantum aqua',
Expand All @@ -82,7 +84,7 @@
include_package_data=True,
python_requires=">=3.5",
extras_require={
'torch': ["torch; sys_platform != 'win32'"],
'torch': ["torch; sys_platform == 'linux' or (python_version < '3.8' and sys_platform != 'win32')"],
},
zip_safe=False
)
Loading

0 comments on commit a51f7db

Please sign in to comment.