{ "cells": [ { "cell_type": "markdown", "id": "898eb4ed", "metadata": {}, "source": [ "# Migrate from `qiskit-optimization` to `qiskit-addon-opt-mapper`" ] }, { "cell_type": "markdown", "id": "97e86ead", "metadata": {}, "source": [ "This migration guide summarizes the steps required to migrate a workflow built using the `qiskit-optimization` [library](https://github.com/qiskit-community/qiskit-optimization) to the new and improved `qiskit-addon-opt-mapper` library. " ] }, { "cell_type": "markdown", "id": "2c4ecca4", "metadata": {}, "source": [ "## TL;DR\n", "\n", "The `qiskit-addon-opt-mapper` library shares a lot of common structure and design with `qiskit-optimization`, with a few key differences that should be taken into account when migrating from one package to the other:\n", "\n", "1. The core data structure of `qiskit-optimization` is the `QuadraticProgram`, in `qiskit-addon-opt-mapper`, this structure is now called `OptimizationProblem`. The core methods and attributes remain consistent with the `QuadraticProgram`, but the class is now extended to support higher order terms in variables, objective function and constraints.\n", "\n", "2. The new `qiskit-addon-opt-mapper` package is focused on the optimization problem modeling and mapping step, which means there isn't a migration path for the former `qiskit-optimization` modules: `algorithms`, `optimizers` and `minimum_eigensolvers`.\n", "\n", "3. The subset of classical solvers from `qiskit-optimization`'s `algorithms` module are now exposed in `qiskit-addon-opt-mapper` in a new `solvers` module." ] }, { "cell_type": "markdown", "id": "eb297c29", "metadata": {}, "source": [ "## Tables" ] }, { "cell_type": "markdown", "id": "3390c217", "metadata": {}, "source": [ "### General migration guidelines\n", "\n", "| `qiskit_optimization` | `qiskit_addon_opt_mapper` |\n", "|-----------------------------------|-------------------------------------|\n", "| `QuadraticProgram` | `OptimizationProblem` |\n", "| any class that contains `QuadraticProgram`, for example, `QuadraticProgramConverter` | `OptimizationProblemConverter` |\n", "| any `to_quadratic_program()` method | `to_optimization_problem()` |\n", "| any `quadratic_program` input parameter or attribute | `optimization_problem` |" ] }, { "cell_type": "markdown", "id": "4fa0f1a9", "metadata": {}, "source": [ "### Migrate classical solvers\n", "\n", "| `qiskit_optimization.algorithms` | `qiskit_addon_opt_mapper.solvers` |\n", "|-----------------------------------|-------------------------------------|\n", "| `OptimizationAlgorithm` | `OptimizationSolver` |\n", "| `OptimizationResult` | `SolverResult` |\n", "| `CplexOptimizer` | `CplexSolver` |\n", "| `GurobiOptimizer` | `GurobiSolver` |\n", "| `ScipyMilpOptimizer` | `ScipyMilpSolver` |\n", "| Any other class in this module | Not part of this package |" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }