Use this file to discover all available pages before exploring further.
View on GitHub
Open this notebook in GitHub to run it yourself
This notebook solve the Low Autocorrlation Binary Sequences (LABS) problem using QAOA. It follows the paper from Shaydulin et al.[1].Later, the paper accepted to the Science Advances journal.The LABS problem is relevant in various fields, including communications engineering, design of radar pulses, and more, where sequences with low autocorrelation properties are desired.The LABS problem is known to be NP-hard.The LABS problem is defined as follows:For a given sequence of spins si∈{−1,+1}, we have the autocorrelation Ak(s).First, define Ak(s), the autocorrelation:Ak(s)=i=1∑N−ksisi+kThe goal of LABS is to find a sequence of spins s that minimizes the so-called “sidelobe” energy:Esidelobe=k=1∑N−1Ak2(s)
import numpy as npimport pyomo.core as pyodef LABS_pyo_model(N: int) -> pyo.ConcreteModel: # N - the binary sequence size - number of spins # return: pyomo classical optimization model of # Low Binary Autocorrelation Binary Sequence (LABS) problem. model = pyo.ConcreteModel() model.s = pyo.Var(range(N), domain=pyo.Binary) s_array = np.array(list(model.s.values())) # transformation: {0,1} -> {-1,+1} spin_s_array = 2 * s_array - 1 autocorrelation_fun = lambda k: sum( [ spin_s_array[i] * spin_s_array[i + k] for i in range(len(spin_s_array[: N - k])) ] ) model.sidelobe_energy = pyo.Objective( expr=sum([autocorrelation_fun(k) ** 2 for k in range(N - 1)]), sense=pyo.minimize, ) return model