Skip to content

Commit

Permalink
Qiskit Optimization (qiskit-community/qiskit-aqua#877)
Browse files Browse the repository at this point in the history
* implement first part of steve's comments

* skip some unnecessary varform checks

* Revert "skip some unnecessary varform checks"

* rename OptimizationProblem with QuadraticProgram

* test cplex installation

* fixed decode func for continuous variables

* fixed format and added docstrings for the test

* fix some codes after merge of upstream

* change None for not impl error

* is_compatible returns bool and raises

* adding support for quadratic constraints

* fixing imports

* rename OptimizationProblem with QuadraticProgram in test_converters

* commenting out quad constraints support

* fix typos, add references

* is_compatible for bool, get_incomptability for msg

* incompatibility in admm / cplex optimizer

* rename to compatibility_msg

* == not >

* update cplex optimizer

* update cplex display settings

* update recursive min optimizer docstring

examples should be in class level, not module level
fix class level docstring in general

* (Re)move utils (qiskit-community/qiskit-aqua#67)

* reorganize utils

* add missing init

* fix import in test

* (Re)move results  (qiskit-community/qiskit-aqua#68)

* move results to algo files

* remove solution/qualitymetrics for now

they are safely stored on another branch but are currently not used so there is no reason to have them in this release

* move the results objects to algorithms

* update quadratic program, linear expression, linear constraint, variable and tests

* add quadratic_expression

* add quadratic constraint and tests

* add quadratic objective

* Update quadratic_program.py

* add linear_constraint

* revise constraints

* fix tests and avoid cyclic import

* fix default quadratic constraint name

* Update test_quadratic_program.py

* moving to a new optimization stack

* update constraints handling

* Update constraint.py

* moving to a new optimization stack

* add __getitem__() to linear and quadratic expressions

* make constants upper case

* (wip) substitute_variables

* Alpha version of substitute_variables

Also moved name arg of linear_constraint and quadratic_constraint in the last

* moving to a new optimization stack

* rename "coefficients_as_dict/array" to "to_dict/array" in linear/quadratic expressions

* add read/write functionality to QP

* Update quadratic_program.py

* update cplex_optimizer and tests

* Update quadratic_program.py

* merge grover_optimizer updates

* moving to a new optimization stack

* cleanup

* add a test of substitute_variables

* replace use_index with use_name

* allow integer as lower bound and upper bound of variable

* change qp as well

* update int to bin converter to use new QP interface

* rename converters without "converter" in name

* update qubo to operator + some minor fixes

* moving to a new optimization stack

* ignore trivial constraints (0 == 0) when converting to docplex

* moving to a new optimization stack

* Update quadratic_program.py

* Update quadratic_program_to_qubo.py

* moving to a new optimization stack

* poc

* modified InequalityToEquality converter for new QuadraticProgram APIs

* Fix issues in integer_to_binary

* bug fixes

* removed importing cplex and fixied linting

* update QP and tests

* add __setitem__ to linear/quadratic expression

* update recursive minimum eigen optimizer

* removing 2* from quad objective

* moving to a new optimization stack

* removing 2* from quad objective

* fix in step2

* fix in get_obj_val

* fix in get_obj_val

* fix in get_obj_val

* Use compressed dictionary as the internal of quadratic expression

* minor

* Update optimization_algorithm.py

* fix a type hint

* moving to a new optimization stack

* moving to a new optimization stack

* use the internal Status directly

* linting

* rename penalize equality constraints converter

* converter bug fixes

* minor re-writing get_bet_merit_solution

* minor re-writing get_bet_merit_solution

* Fix unit tests related to quadratic expressions

* Fix the declaration of __init__.py

* Small fixes for pylint

* moving to 'evaluate' in objective cost and constraints

* added operator_to_quadratic_probram for new QP APIs

* Current GroverOptimizer Code, New QP Interface WIP

* GroverOptimizer Uses New QP Interface

* added unittests

* Add more tests of QuadraticProgram

* Update test_quadratic_program_to_negative_value_oracle.py

* formatting, renaming, minor changes

* Update grover_optimizer.py

* Add a missing sample LP file for test_quadratic_program

* small fix of parsing problem name of LP file

* fix a typo

* only test based on exact solver (other redundant)

* fix random seeds

* add remove linear/quadratic constraints

* remove util.py

* Update quadratic_program_to_qubo.py

* fix a factor

* Bump Terra version requirements to 0.14.0

* fix var_form initialization

* check cplex installed on unit tests

* step2 generation based on a copy

* step2 generation based on a copy

* step2 generation based on a copy

* formatting, renaming, minor changes

* fixing converters / compatibility checks of algorithms

* clean grover code (remove debugging lines)

* fix IQFT and random seeds

* Update test_quadratic_program_to_negative_value_oracle.py

* Update operator_to_quadratic_program.py

* Add QuadraticProgram.Status to replace SubstitutionStatus

* add a test of status for clear

* Embed enum data in classes

* minor

* tune

* enable type hint of enums

* supporting equality and quadratic constraints

* more simplifications

* admm tests on  equality and quadratic constraints

* fixes and more testing

* deal with from_docplex corner cases

* more simplifications, linting

* Update quadratic_program.py

use `model.iter_{linear, quadratic}_constraints()` instead of `model.get_constraint_by_index(i)`, since the latter calls CPLEX which is not available in Python 3.8.

* easy part of steve's comments

* part 2 of steve's comments

* add comments

* fix problem with int2bin converter

* enabled int2bin converter

* update problems __init__.py docstring

* rename `HasQuadraticProgram` to `QuadraticProgramElement`

* rename `HasQuadraticProgram` to `QuadraticProgramElement` (2)

* module level docstrings, offset test

* fix spell & test

* leftover fixes

* update changelog and ADMM docstring

* fix write to dir, use new tempfile functionality

* fix docstring

* add changelog

* remove Grover Optimization changelog

* trigger CLA check

* fix qasm string on unit tests

Co-authored-by: Cryoris <jules.gacon@googlemail.com>
Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: Takashi Imamichi <t.imamichi@gmail.com>
Co-authored-by: Anton Dekusar <adekusar@ie.ibm.com>
Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Co-authored-by: Atsushi Matsuo <MATSUOA@jp.ibm.com>
Co-authored-by: Austin Gilliam <austin.gilliam777@gmail.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Claudio Gambella <claudio.gambella1@ie.ibm.com>
Co-authored-by: adekusar-drl <62334182+adekusar-drl@users.noreply.github.com>
  • Loading branch information
11 people authored Apr 27, 2020
1 parent 99649e7 commit 4e2ba0d
Show file tree
Hide file tree
Showing 80 changed files with 8,596 additions and 89 deletions.
23 changes: 16 additions & 7 deletions qiskit/optimization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,31 @@
====================================================================
Optimization application stack for Aqua (:mod:`qiskit.optimization`)
====================================================================
This is the finance domain logic....
.. currentmodule:: qiskit.optimization
Submodules
==========
Contents
========
.. autosummary::
:toctree:
:toctree: ../stubs/
:nosignatures:
ising
QuadraticProgram
QiskitOptimizationError
INFINITY
"""

from .infinity import INFINITY # must be at the top of the file
from .exceptions import QiskitOptimizationError
from .problems import QuadraticProgram
from ._logging import (get_qiskit_optimization_logging,
set_qiskit_optimization_logging)

__all__ = ['get_qiskit_optimization_logging',
'set_qiskit_optimization_logging']
__all__ = ['QuadraticProgram',
'QiskitOptimizationError',
'get_qiskit_optimization_logging',
'set_qiskit_optimization_logging',
'INFINITY'
]
60 changes: 60 additions & 0 deletions qiskit/optimization/algorithms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-

# This code is part of Qiskit.
#
# (C) Copyright IBM 2019, 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
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""
===================================================================
Optimization stack for Aqua (:mod:`qiskit.optimization.algorithms`)
===================================================================
Algorithms for optimization algorithms.
.. currentmodule:: qiskit.optimization.algorithms
Base class
==========
.. autosummary::
:toctree: ../stubs/
:nosignatures:
OptimizationAlgorithm
Algorithms
==========
.. autosummary::
:toctree: ../stubs/
:nosignatures:
ADMMOptimizer
CobylaOptimizer
CplexOptimizer
GroverOptimizer
MinimumEigenOptimizer
RecursiveMinimumEigenOptimizer
"""

from .optimization_algorithm import OptimizationResult
from .optimization_algorithm import OptimizationAlgorithm
from .admm_optimizer import ADMMOptimizer
from .cplex_optimizer import CplexOptimizer
from .cobyla_optimizer import CobylaOptimizer
from .minimum_eigen_optimizer import MinimumEigenOptimizer
from .recursive_minimum_eigen_optimizer import RecursiveMinimumEigenOptimizer
from .grover_optimizer import GroverOptimizer, GroverOptimizationResults

__all__ = ["ADMMOptimizer", "OptimizationAlgorithm", "OptimizationResult", "CplexOptimizer",
"CobylaOptimizer", "MinimumEigenOptimizer", "RecursiveMinimumEigenOptimizer",
"GroverOptimizer", "GroverOptimizationResults"]
Loading

0 comments on commit 4e2ba0d

Please sign in to comment.