Skip to main content

View on GitHub

Open this notebook in GitHub to run it yourself
For a set of N power plants (sources) and M consumers, the goal is to supply power to all consumers while meeting the constraints of the power plants and minimizing the total cost of supplying power. The model here is a minor variation of [1]. Mathematical model, minimizing the objective function: z=∑i=1n∑j=1mZijxijz = \sum_{i=1}^{n} \sum_{j=1}^{m} Z_{ij}x_{ij} where xijx_{ij} is the required values of the transmitted power from source AiA_i to consumer BjB_j. The unit cost of transmitting power from node AiA_i to node BjB_j is ZijZ_{ij}. Constraint: the sum of powers flowing from power plant transmission lines to all customer nodes must be up to the power of the source AiA_i: ∑j=1Mxij≤Aii=1,2,...,N\sum_{j=1}^{M} x_{ij} \leq A_{i} \quad i=1,2,...,N Each consumer receives power BjB_{j}: ∑i=1Nxij=Bjj=1,2,...,M\sum_{i=1}^{N} x_{ij} = B_{j} \quad j=1,2,...,M This example takes Bj=1B_{j} = 1 and Ai=2A_{i} = 2. Note the use of two kinds of constraints: equality and inequality.

Building the Problem

Output:
output Build the Pyomo mjodel for a classical combinatorial optimization problem:
Print the classical optimization problem:
Output:

Solving with Classiq

Take the specific example outlined above.

Generating Parameters for the Quantum Circuit

Synthesizing the QAOA Circuit and Solving the Problem

Synthesize and view the QAOA circuit (ansatz) used to solve the optimization problem:
Output:
Output:
Solve the problem by calling the optimize method of the CombinatorialProblem object. For the classical optimization part of QAOA, define the maximum number of classical iterations (maxiter) and the α\alpha-parameter (quantile) for running CVaR-QAOA, an improved variation of the QAOA algorithm [3]:
Check the convergence of the run:
Output:
output

Best Solution Statistics

Compare the optimized results to uniformly sampled results:
And compare the histograms:
output

Best Solution

Output:
Output:
B1B2B3B4
A10100
A21001
A30010
output

Comparing to a Classical Solver

Output:
Output:
B1B2B3B4
A11.0000000.0000000.0000000.000000
A20.0000001.0000000.0000001.000000
A30.000000-0.0000001.0000000.000000
output

References

[1] O. V. Shemelova, E. V. Yakovleva, T. G. Makuseva, I. I. Eremina, and O. N. Makusev. (2019). Solving optimization problems when designing power supply circuits. E3S Web of Conferences 124, 04011.