{"id":13536211,"url":"https://github.com/qiskit-community/qiskit-optimization","last_synced_at":"2025-05-14T19:08:52.893Z","repository":{"id":37353827,"uuid":"329700534","full_name":"qiskit-community/qiskit-optimization","owner":"qiskit-community","description":"Quantum Optimization","archived":false,"fork":false,"pushed_at":"2025-04-22T01:39:26.000Z","size":18284,"stargazers_count":250,"open_issues_count":33,"forks_count":139,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-14T19:08:51.064Z","etag":null,"topics":["qiskit"],"latest_commit_sha":null,"homepage":"https://qiskit-community.github.io/qiskit-optimization/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qiskit-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-14T18:25:46.000Z","updated_at":"2025-05-02T16:55:35.000Z","dependencies_parsed_at":"2023-07-26T19:59:16.813Z","dependency_job_id":"f5591409-446f-433e-9e65-7863f2c01925","html_url":"https://github.com/qiskit-community/qiskit-optimization","commit_stats":null,"previous_names":["qiskit-community/qiskit-optimization","qiskit/qiskit-optimization"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiskit-community%2Fqiskit-optimization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiskit-community%2Fqiskit-optimization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiskit-community%2Fqiskit-optimization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiskit-community%2Fqiskit-optimization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qiskit-community","download_url":"https://codeload.github.com/qiskit-community/qiskit-optimization/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["qiskit"],"created_at":"2024-08-01T09:00:35.908Z","updated_at":"2025-05-14T19:08:51.387Z","avatar_url":"https://github.com/qiskit-community.png","language":"Python","funding_links":[],"categories":["Quantum Software Packages","Community"],"sub_categories":[],"readme":"# Qiskit Optimization\n\n[![License](https://img.shields.io/github/license/Qiskit/qiskit-optimization.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)\u003c!--- long-description-skip-begin --\u003e[![Build Status](https://github.com/qiskit-community/qiskit-optimization/workflows/Optimization%20Unit%20Tests/badge.svg?branch=main)](https://github.com/qiskit-community/qiskit-optimization/actions?query=workflow%3A\"Optimization%20Unit%20Tests\"+branch%3Amain+event%3Apush)[![](https://img.shields.io/github/release/Qiskit/qiskit-optimization.svg?style=popout-square)](https://github.com/qiskit-community/qiskit-optimization/releases)[![](https://img.shields.io/pypi/dm/qiskit-optimization.svg?style=popout-square)](https://pypi.org/project/qiskit-optimization/)[![Coverage Status](https://coveralls.io/repos/github/Qiskit/qiskit-optimization/badge.svg?branch=main)](https://coveralls.io/github/Qiskit/qiskit-optimization?branch=main)\u003c!--- long-description-skip-end --\u003e\n\n\u003e [!WARNING]\n\u003e **Qiskit Optimization is no longer officially supported by IBM**.\n\u003e Like any other Apache 2 licensed code, you are free to use it or/and extend it, but please be aware that it is under your own risk.\n\n**Qiskit Optimization** is an open-source framework that covers the whole range from high-level modeling of optimization\nproblems, with automatic conversion of problems to different required representations, to a suite\nof easy-to-use quantum optimization algorithms that are ready to run on classical simulators,\nas well as on real quantum devices via Qiskit.\n\nThe Optimization module enables easy, efficient modeling of optimization problems using\n[docplex](https://ibmdecisionoptimization.github.io/docplex-doc/).\nA uniform interface as well as automatic conversion between different problem representations\nallows users to solve problems using a large set of algorithms, from variational quantum algorithms,\nsuch as the Quantum Approximate Optimization Algorithm QAOA, to Grover Adaptive Search using the\nGroverOptimizer, leveraging fundamental algorithms provided by\n[Qiskit Algorithms](https://qiskit-community.github.io/qiskit-algorithms/). Furthermore, the modular design\nof the optimization module allows it to be easily extended and facilitates rapid development and\ntesting of new algorithms. Compatible classical optimizers are also provided for testing,\nvalidation, and benchmarking.\n\n## Installation\n\nWe encourage installing Qiskit Optimization via the pip tool (a python package manager).\n\n```bash\npip install qiskit-optimization\n```\n\n**pip** will handle all dependencies automatically and you will always install the latest\n(and well-tested) version.\n\nIf you want to work on the very latest work-in-progress versions, either to try features ahead of\ntheir official release or if you want to contribute to Optimization, then you can install from source.\nTo do this follow the instructions in the\n [documentation](https://qiskit-community.github.io/qiskit-optimization/getting_started.html#installation).\n\n\n----------------------------------------------------------------------------------------------------\n\n### Optional Installs\n\n* **IBM CPLEX** may be installed using `pip install 'qiskit-optimization[cplex]'` to enable the reading of `LP` files and the usage of\n  the `CplexOptimizer`, wrapper for ``cplex.Cplex``. CPLEX is a separate package and its support of Python versions is independent of Qiskit Optimization, where this CPLEX command will have no effect if there is no compatible version of CPLEX available (yet).\n\n* **CVXPY** may be installed using the command `pip install 'qiskit-optimization[cvx]'`.\n  CVXPY being installed will enable the usage of the Goemans-Williamson algorithm as an optimizer `GoemansWilliamsonOptimizer`.\n\n* **Matplotlib** may be installed using the command `pip install 'qiskit-optimization[matplotlib]'`.\n  Matplotlib being installed will enable the usage of the `draw` method in the graph optimization application classes.\n\n* **Gurobipy** may be installed using the command `pip install 'qiskit-optimization[gurobi]'`.\n  Gurobipy being installed will enable the usage of the GurobiOptimizer.\n\n### Creating Your First Optimization Programming Experiment in Qiskit\n\nNow that Qiskit Optimization is installed, it's time to begin working with the optimization module.\nLet's try an optimization experiment to compute the solution of a\n[Max-Cut](https://en.wikipedia.org/wiki/Maximum_cut). The Max-Cut problem can be formulated as\nquadratic program, which can be solved using many several different algorithms in Qiskit.\nIn this example, the MinimumEigenOptimizer\nis employed in combination with the Quantum Approximate Optimization Algorithm (QAOA) as minimum\neigensolver routine.\n\n```python\nfrom docplex.mp.model import Model\n\nfrom qiskit_optimization.algorithms import MinimumEigenOptimizer\nfrom qiskit_optimization.translators import from_docplex_mp\nfrom qiskit_optimization.utils import algorithm_globals\nfrom qiskit_optimization.minimum_eigensolvers import QAOA\nfrom qiskit_optimization.optimizers import SPSA\n\nfrom qiskit.primitives import Sampler\n\n# Generate a graph of 4 nodes\nn = 4\nedges = [(0, 1, 1.0), (0, 2, 1.0), (0, 3, 1.0), (1, 2, 1.0), (2, 3, 1.0)]  # (node_i, node_j, weight)\n\n# Formulate the problem as a Docplex model\nmodel = Model()\n\n# Create n binary variables\nx = model.binary_var_list(n)\n\n# Define the objective function to be maximized\nmodel.maximize(model.sum(w * x[i] * (1 - x[j]) + w * (1 - x[i]) * x[j] for i, j, w in edges))\n\n# Fix node 0 to be 1 to break the symmetry of the max-cut solution\nmodel.add(x[0] == 1)\n\n# Convert the Docplex model into a `QuadraticProgram` object\nproblem = from_docplex_mp(model)\n\n# Run quantum algorithm QAOA on qasm simulator\nseed = 1234\nalgorithm_globals.random_seed = seed\n\nspsa = SPSA(maxiter=250)\nsampler = Sampler()\nqaoa = QAOA(sampler=sampler, optimizer=spsa, reps=5)\nalgorithm = MinimumEigenOptimizer(qaoa)\nresult = algorithm.solve(problem)\nprint(result.prettyprint())  # prints solution, x=[1, 0, 1, 0], the cost, fval=4\n```\n\n### Further examples\n\nLearning path notebooks may be found in the\n[optimization tutorials](https://qiskit-community.github.io/qiskit-optimization/tutorials/index.html) section\nof the documentation and are a great place to start.\n\n----------------------------------------------------------------------------------------------------\n\n## Contribution Guidelines\n\nIf you'd like to contribute to Qiskit, please take a look at our\n[contribution guidelines](https://github.com/qiskit-community/qiskit-optimization/blob/main/CONTRIBUTING.md).\nThis project adheres to Qiskit's [code of conduct](https://github.com/qiskit-community/qiskit-optimization/blob/main/CODE_OF_CONDUCT.md).\nBy participating, you are expected to uphold this code.\n\nWe use [GitHub issues](https://github.com/qiskit-community/qiskit-optimization/issues) for tracking requests and bugs. Please\n[join the Qiskit Slack community](https://qisk.it/join-slack)\nand for discussion and simple questions.\nFor questions that are more suited for a forum, we use the **Qiskit** tag in [Stack Overflow](https://stackoverflow.com/questions/tagged/qiskit).\n\n## Authors and Citation\n\nOptimization was inspired, authored and brought about by the collective work of a team of researchers.\nOptimization continues to grow with the help and work of\n[many people](https://github.com/qiskit-community/qiskit-optimization/graphs/contributors), who contribute\nto the project at different levels.\nIf you use Qiskit, please cite as per the provided\n[BibTeX file](https://github.com/Qiskit/qiskit/blob/main/CITATION.bib).\n\n## License\n\nThis project uses the [Apache License 2.0](https://github.com/qiskit-community/qiskit-optimization/blob/main/LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqiskit-community%2Fqiskit-optimization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqiskit-community%2Fqiskit-optimization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqiskit-community%2Fqiskit-optimization/lists"}