# Release Notes¶

## 0.3.0¶

### New Features¶

Adding the bin-packing application

`qiskit_optimization.applications.BinPacking`

. https://en.wikipedia.org/wiki/Bin_packing_problem

Added the runtime client

`QAOAClient`

to execute the QAOA algorithm on Qiskit runtime. This runtime program leverages QAOA dedicated transpiler passes such as swap strategies and pulse-efficient transpiler passes for cross-resonance based hardware. Both these optimizations can significantly reduce circuit depth and improve execution time and results. Further, the QAOA runtime also allows using CVaR expectation values, which can improve the performance of ground state calculations in optimization settings.The client can for instance be used as

from qiskit import IBMQ from qiskit.algorithms.optimizers import COBYLA from qiskit.opflow import I, Z from qiskit_optimization.runtime import QAOAClient # get the provider and backend we use to run the program IBMQ.load_account() provider = IBMQ.get_provider(hub="ibm-q", group="open", project="main") backend = provider.get_backend("ibmq_qasm_simulator") # define diagonal Hamiltonian whose minimum eigenvalue we want to find op = (Z ^ Z ^ I ^ I ^ I) - (I ^ I ^ Z ^ Z ^ I) # set up the client and solve the problem client = QAOAClient( reps=2, # use p=2 repetitions in the QAOA ansatz optimizer=COBYLA(), alpha=0.75, # use CVaR expectation with 75% of the best readouts provider=provider, backend=backend ) result = client.compute_minimum_eigenvalue(op)

See also the new QAOA Runtime tutorial in

`docs/tutorials/12_qaoa_runtime.ipynb`

for more details.

`qiskit_optimization.translators.from_docplex_mp()`

supports logical expressions of Docplex, i.e., logical_and, logical_or, and logical_not.For example:

from docplex.mp.model import Model from qiskit_optimization.translators import from_docplex_mp mod = Model() x = mod.binary_var('x') y = mod.binary_var('y') mod.add_constraint(mod.logical_and(x, y) <= 1) qp = from_docplex_mp(mod)

Introduced the Sherrington-Kirkpatrick (SK) model [1]

`qiskit_optimization.applications.SKModel`

. The model has all-to-all ferromagnetic and antiferromagnetic interactions given by a random disorder and represents a mean-field approximation of a spin glass.Let \(x\in\{\pm 1\}^n\) be a configuration of spins. The SK model Hamiltonian on \(n\) sites is

\[\begin{array}{} H(x)=-1/\sqrt{n} \sum_{i<j} w_{i,j}x_ix_j,\text{ where } i,j\in [n], \end{array}\]\(w_{i,j}\in\{\pm 1\}\) are called disorder and are chosen independently and uniformly at random.

The computational problem associated with this class is to find the ground state of the SK Hamiltonian instance and its energy.

[1]: Dmitry Panchenko. “The Sherrington-Kirkpatrick model: an overview”, https://arxiv.org/abs/1211.1094

### Upgrade Notes¶

The deprecated methods

`QuadraticProgram.from_docplex`

and`QuadraticProgram.to_docplex`

have been removed and no longer exist. These methods were deprecated as part of the 0.2.0 release. Instead you should use`from_docplex_mp()`

and`to_docplex_mp()`

.

### Deprecation Notes¶

Rename the runtime “programs” to runtime “clients” to avoid name confusions and reflect the fact that they are an interface for code executed in the cloud. The classes

`VQEProgram`

,`QAOAProgram`

and`VQEProgramResult`

have been renamed to`VQERuntimeClient`

,`QAOARuntimeClient`

and`VQERuntimeResult`

, respectively.

### Bug Fixes¶

Fix

`qiskit_optimization.converters.IntegerToBinary`

to convert quadratic terms correctly.

Fix

`qiskit_optimization.converters.IntegerToBinary`

to convert variables with zero range, i.e., the lower bound is equal to the upper bound, without raising any error.

If an indicator constraint of a Docplex model does not have a name,

`qiskit_optimization.translators.from_docplex_mp()`

adds a name`ind{number}`

for sense`<=`

and`>=`

or names`ind{number}_LE`

and`ind{number}_GE`

for sense`==`

.

If an indicator constraint of a Docplex model includes

`binary_var`

as part of`linear_ct`

,`qiskit_optimization.translators.from_docplex_mp()`

handles the coefficient properly.

If a trivial constraint is included in a Docplex model,

`qiskit_optimization.translators.from_docplex_mp()`

raises an`UserWarning`

and converts it into a constraint of`qiskit_optimization.problems.QuadraticProgram`

as is.

If a trivial constraint is included in

`qiskit_optimization.problems.QuadraticProgram`

,`qiskit_optimization.translators.to_docplex_mp()`

converts it into a constraint of Docplex without any error.

Allow Qiskit’s

`Optimizer`

classes as input for the`optimizer`

in the`VQEProgram`

and`QAOAProgram`

instead of only dictionaries.

## 0.2.0¶

### New Features¶

Adds

`qiskit_optimization.problems.LinearExpression.bounds()`

and`qiskit_optimization.problems.QuadraticExpression.bounds()`

that return the lower bound and the upper bound of the expressions.

Adds

`qiskit_optimization.algorithms.GurobiOptimizer`

.`pip install qiskit_optimization[gurobi]`

installs gurobipy to enable this optimizer.

Adds the support of indicator constraints (e.g.

`x=1 -> y+z=1`

) in`from_docplex_mp()`

using the big-M formulation.

Adds translators between Ising Hamiltonian and

`qiskit_optimization.problems.QuadraticProgram`

,`from_ising()`

and`to_ising()`

.

Adds model translators between modeling libraries (e.g., docplex and gurobipy) and

`QuadraticProgram`

. Adds translator functions`from_docplex_mp()`

,`to_docplex_mp()`

,`from_gurobipy()`

, and`to_gurobipy()`

to`translators`

.

Introduced a new converter class

`qiskit_optimization.converters.MinimizeToMaximize`

. It converts a problem to a maximization problem.

Introduced a new converter class

`qiskit_optimization.converters.LinearInequalityToPenalty`

. It converts the following inequality constraints to penalty terms where x, y, \(x_i\) are binary variables and P is a penalty factor.\[\begin{split}\begin{array}{} \text { Inequality constraint } & & \text { Penalty term } \\ x \leq y & \rightarrow & P(x-x y) \\ x \geq y & \rightarrow & P(y-x y) \\ \sum_{i=1}^n x_i \leq 1, n \geq 2 & \rightarrow & P \sum_{i, j : i < j} x_i x_j\\ \sum_{i=1}^n x_i \geq n-1, n \geq 2 & \rightarrow & P \sum_{i, j : i < j} (1 - x_i) (1 - x_j) \end{array}\end{split}\]

Introduced a new converter class

`qiskit_optimization.converters.MaximizeToMinimize`

. It converts a problem to a minimization problem. The converter was added to the default converters in`qiskit_optimization.converters.QuadraticProgramToQubo`

. Algorithms that use`QuadraticProgramToQubo`

apply`MaximizeToMinimize`

internally.

Allow leveraging Qiskit Runtime to execute VQE and QAOA in the cloud using the

`VQEProgram`

and`QAOAProgram`

.

### Upgrade Notes¶

Simplifies

`qiskit_optimization.algorithms.CplexOptimizer`

by calling CPLEX from`docplex.mp.model.Model.solve`

directly. Also adds a fallback code if no solution is found by CPLEX.

Adds

`cplex_parameters`

as a dictionary to`qiskit_optimization.algorithms.CplexOptimizer`

so that users can set CPLEX parameters such as time limit and number of threads.

`QuadraticProgram.pprint_as_string`

and`QuadraticProgram.prettyprint`

have been removed, which were deprecated in Qiskit Aqua 0.8.0 release (October 2020).

Changes

`qiskit_optimization.algorithms.MinimumEigenOptimizer.solve()`

to return the best solution in terms of the original problem, i.e.,`MinimumEigenOptimizationResult.samples[0]`

, as`qiskit_optimization.algorithms.MinimumEigenOptimizationResult.x()`

. It used to be the best solution in terms of the converted QUBO problem, i.e.,`MinimumEigenOptimizationResult.raw_samples[0]`

.

### Deprecation Notes¶

`from_docplex()`

,`to_docplex()`

are deprecated because`from_docplex_mp()`

and`to_docplex_mp()`

cover the features.

### Bug Fixes¶

Fix bit ordering in

`qiskit_optimization.algorithms.MinimumEigenOptimizer`

with qasm_simulator.

Fix probabilities of solution samples with qasm_simulator in

`qiskit_optimization.algorithms.MinimumEigenOptimizer`

. See https://github.com/Qiskit/qiskit-optimization/pull/97 for details.

Fixes

`qiskit_optimization.problems.QuadraticObjective.evaluate()`

and`qiskit_optimization.problems.QuadraticObjective.evaluate_gradient()`

to raise`QiskitOptimizationError`

with an appropriate message if no objective function is set.

Fixes

`rotation_count`

in`qiskit_optimization.algorithms.GroverOptimizer`

. This fix uses`algorithm_globals.random.integers(0, m)`

to generate a random integer in a range 0..m-1.

Sorts the order of

`result.get_counts(qc)`

by bitstring in`qiskit_optimization.algorithms.GroverOptimizer`

when`qasm_simulator`

is used so that the algorithm behaves deterministically. The previous version sorts the counts by probabilities, but some bitstrings may have the same probability and the algorithm could behave probabilistically.

Fixes

`qiskit_optimization.algorithms.GoemansWilliamsonOptimizer`

. If a minimization problem is passed to the optimizer, then it is converted to a maximization problem and then solved.