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

SLSQP optimizer, multistart Cobyla, enhanced compatibility checks #1082

Merged
merged 30 commits into from
Jul 7, 2020

Conversation

adekusar-drl
Copy link
Contributor

Summary

Added a new optimizer to the Qiskit optimization module that wraps already existing SLSQP solver.

Details and comments

Changes:

  • New class added: qiskit.optimization.algorithm.SlsqpOptimizer
  • Added methods evaluate_gradient to LinearExpression, QuadraticExpression, QuadraticObjective
  • Added new tests for the new optimizer, added evaluate_gradient methods

@stefan-woerner please pay attention to this PR since I added methods to the base classes.

@woodsp-ibm woodsp-ibm added the Changelog: New Feature Include in the Added section of the changelog label Jun 30, 2020
@woodsp-ibm
Copy link
Member

Can I ask you add a reno yaml file - the changes are being managed via this tool now. There is information on how to install in contributing file https://github.com/Qiskit/qiskit-aqua/blob/master/CONTRIBUTING.md#release-notes

@adekusar-drl
Copy link
Contributor Author

Can I ask you add a reno yaml file - the changes are being managed via this tool now. There is information on how to install in contributing file https://github.com/Qiskit/qiskit-aqua/blob/master/CONTRIBUTING.md#release-notes

Done

woodsp-ibm
woodsp-ibm previously approved these changes Jun 30, 2020
@adekusar-drl adekusar-drl changed the title SLSQP optimizer as a wrapper of scipy SLSQP optimizer, multistart Cobyla, enhanced compatibility checks Jul 6, 2020
@adekusar-drl
Copy link
Contributor Author

@woodsp-ibm, @stefan-woerner
There are a few changes, so please take a look at the PR again.
What's new now:

  1. MultiStartOptimizer handles a multi start for local optimizers like SLSQP and COBYLA. The way how initial guesses are sampled is changed after a discussion with the team. Now they are guesses uniformly with some clipping if variables are unbounded.
  2. SlsqpOptimizer now extends MultiStartOptimizer.
  3. Added multi start support to COBYLA as Stefan mentioned.
  4. Compatibility checks are now different.
    In optimizers there's a line
self._verify_compatibility(problem)

And in the OptimizationAlgorithm there is

    def _verify_compatibility(self, problem: QuadraticProgram) -> None:
        msg = self.get_compatibility_msg(problem)
        if msg:
            raise QiskitOptimizationError('Incompatible problem: {}'.format(msg))

We can enforce this compatibility check for every optimizer as now it is up to optimizers to call this new method directly. Such enforcement will require more changes in the optimizers, more abstractions, etc.

stefan-woerner
stefan-woerner previously approved these changes Jul 6, 2020
@adekusar-drl
Copy link
Contributor Author

The PR was blocked by the error introduced outside of the PR.

stefan-woerner
stefan-woerner previously approved these changes Jul 7, 2020
@stefan-woerner stefan-woerner added this to the 0.8 milestone Jul 7, 2020
@adekusar-drl adekusar-drl merged commit d45f689 into qiskit-community:master Jul 7, 2020
manoelmarques added a commit to manoelmarques/qiskit-aqua that referenced this pull request Jul 28, 2020
…skit-community#1082)

* slsqp implementation

* slsqp implementation

* slsqp implementation, linting, style, docstring

* tests, style, linting, spelling

* spelling

* review changes

* review changes

* doctests, reverting back some changes.

* doctests

* added a reno yaml file for slsqp

* multistart cobyla and new compatibility check

* weird spell checker

* more linting

* edited reno note, more on docstring.

* spelling

* more on multi start optimizer

* more on multi start optimizer

* fixed clip type in multistart_optimizer.py

Co-authored-by: Manoel Marques <[email protected]>
@adekusar-drl adekusar-drl deleted the slsqp branch August 5, 2020 11:50
pbark pushed a commit to pbark/qiskit-aqua that referenced this pull request Sep 16, 2020
…skit-community#1082)

* slsqp implementation

* slsqp implementation

* slsqp implementation, linting, style, docstring

* tests, style, linting, spelling

* spelling

* review changes

* review changes

* doctests, reverting back some changes.

* doctests

* added a reno yaml file for slsqp

* multistart cobyla and new compatibility check

* weird spell checker

* more linting

* edited reno note, more on docstring.

* spelling

* more on multi start optimizer

* more on multi start optimizer

* fixed clip type in multistart_optimizer.py

Co-authored-by: Manoel Marques <[email protected]>
manoelmarques added a commit to qiskit-community/qiskit-optimization that referenced this pull request Jan 14, 2021
…skit-community/qiskit-aqua#1082)

* slsqp implementation

* slsqp implementation

* slsqp implementation, linting, style, docstring

* tests, style, linting, spelling

* spelling

* review changes

* review changes

* doctests, reverting back some changes.

* doctests

* added a reno yaml file for slsqp

* multistart cobyla and new compatibility check

* weird spell checker

* more linting

* edited reno note, more on docstring.

* spelling

* more on multi start optimizer

* more on multi start optimizer

* fixed clip type in multistart_optimizer.py

Co-authored-by: Manoel Marques <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Changelog: New Feature Include in the Added section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants