diff --git a/doc/source/api-reference/qibo.rst b/doc/source/api-reference/qibo.rst index e0ccaba705..cb8570bec1 100644 --- a/doc/source/api-reference/qibo.rst +++ b/doc/source/api-reference/qibo.rst @@ -174,14 +174,6 @@ Grover's Algorithm :member-order: bysource -Travelling Salesman Problem -""""""""""""""""""""""""""" - -.. automodule:: qibo.models.tsp - :members: - :member-order: bysource - - Iterative Quantum Amplitude Estimation (IQAE) """"""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/source/code-examples/applications-by-topic.rst b/doc/source/code-examples/applications-by-topic.rst index 500300e9b4..64bf916deb 100644 --- a/doc/source/code-examples/applications-by-topic.rst +++ b/doc/source/code-examples/applications-by-topic.rst @@ -77,12 +77,3 @@ Quantum Machine Learning tutorials/qcnn_classifier/qcnn_demo.ipynb tutorials/qclustering/README.md tutorials/adiabatic_qml/adiabatic-qml.ipynb - -Combinatorics -^^^^^^^^^^^^^ - -.. toctree:: - :maxdepth: 1 - - tutorials/qap/README.md - tutorials/mvc/README.md diff --git a/doc/source/code-examples/applications.rst b/doc/source/code-examples/applications.rst index 6b1337677c..ee4dbd8ec1 100644 --- a/doc/source/code-examples/applications.rst +++ b/doc/source/code-examples/applications.rst @@ -86,16 +86,6 @@ Quantum Machine Learning tutorials/qclustering/README.md tutorials/adiabatic_qml/adiabatic-qml.ipynb -Combinatorics -^^^^^^^^^^^^^ - -.. toctree:: - :maxdepth: 1 - - tutorials/qap/README.md - tutorials/mvc/README.md - - Applications by algorithm ------------------------- diff --git a/doc/source/code-examples/tutorials/mvc/README.md b/doc/source/code-examples/tutorials/mvc/README.md deleted file mode 120000 index 5e9397841f..0000000000 --- a/doc/source/code-examples/tutorials/mvc/README.md +++ /dev/null @@ -1 +0,0 @@ -../../../../../examples/mvc/README.md \ No newline at end of file diff --git a/doc/source/code-examples/tutorials/qap/README.md b/doc/source/code-examples/tutorials/qap/README.md deleted file mode 120000 index 047aaaa93c..0000000000 --- a/doc/source/code-examples/tutorials/qap/README.md +++ /dev/null @@ -1 +0,0 @@ -../../../../../examples/qap/README.md \ No newline at end of file diff --git a/examples/README.md b/examples/README.md index 7b68e4ed28..4c32c815a6 100644 --- a/examples/README.md +++ b/examples/README.md @@ -26,8 +26,6 @@ physics problems. - [Quantum anomaly detection](anomaly_detection/README.md) - [Quantum k-medians clustering](qclustering/README.md) - [Determining probability density functions with adiabatic quantum computing](adiabatic_qml/adiabatic-qml.ipynb) -- [Quadratic assignment problem (QAP)](qap/README.md) -- [Minimum Vertex Cover (MVC)](mvc/README.md) In the `benchmarks` folder we have included examples concerning: - A generic benchmark script for multiple circuits (`benchmarks/main.py`) diff --git a/examples/mvc/README.md b/examples/mvc/README.md deleted file mode 100644 index a31030ea83..0000000000 --- a/examples/mvc/README.md +++ /dev/null @@ -1,222 +0,0 @@ -# Minimum Vertex Cover (MVC) - -Code at: [https://github.com/qiboteam/qibo/tree/master/examples/mvc](https://github.com/qiboteam/qibo/tree/master/examples/mvc) - -Given an undirected graph with a set of nodes V and edges E, A vertex cover of a graph is a set of nodes that includes at -least one endpoint of every edge of the graph. The Minimum Vertex Cover (MVC) problem is an optimisation problem -that find smallest vertex cover of a given graph. - -## Load graph from csv - - -```python -import networkx as nx -import csv -import matplotlib.pyplot as plt - -from mvc import qubo_mvc, qubo_mvc_penalty, mvc_feasibility, mvc_easy_fix, mvc_energy - - -def load_csv(filename:str): - """ Load graph from csv file - """ - - with open(filename, 'r', newline='') as f: - reader = csv.reader(f) - data = [[int(row[0]), int(row[1]), float(row[2])] for row in reader] - - nodes = [k0 for k0, k1, v in data if k0 == k1] - edges = [[k0, k1] for k0, k1, v in data if k0 != k1] - - g = nx.Graph() - g.add_nodes_from(nodes) - g.add_edges_from(edges) - - node_weights = {k0: {'weight': v} for k0, k1, v in data if k0 == k1} - edge_weights = {(k0, k1): {'weight': v} for k0, k1, v in data if k0 != k1} - - nx.set_edge_attributes(g, edge_weights) - nx.set_node_attributes(g, node_weights) - - return g -``` - -csv Format: - -0,0,0.4696822179283675 -1,1,0.6917392308135916 -2,2,0.7130420958314817 -3,3,0.49342677332980056 -4,4,0.49661600571433673 -5,5,0.55601135361347 -6,6,0.2831095711244086 -7,7,0.18737823232636885 -0,1,0.98602725407379 -1,2,0.935853268681996 -2,3,0.23080434023289664 -4,5,0.25521731195623476 -5,6,0.37096743935296606 -6,7,0.04408120693490547 -0,2,0.5619060764177991 -4,7,0.48402095290884917 -1,6,0.7106584134580318 - - - -```python -g = load_csv('mvc.csv') -``` - - -```python -pos = nx.spring_layout(g, seed=1234) -nx.draw(g, pos) -``` - - -```python -print(f'Number of node is {len(g.nodes)}') -print(f'Number of edge is {len(g.edges)}') -``` - - Number of node is 8 - Number of edge is 9 - - -## QUBO formulation - -### Estimate penalty - - -```python -penalty = qubo_mvc_penalty(g) -print(f'The penalty is {penalty}') -``` - - The penalty is 1.6548482220717595 - - -### Formulate QUBO (weighted minimum vertex cover) - - -```python -linear, quadratic = qubo_mvc(g, penalty=penalty) -print(f'Number of linear terms: {len(linear)}') -print(f'Number of quadratic terms: {len(quadratic)}\n') -``` - - Number of linear terms: 8 - Number of quadratic terms: 9 - - - -### Generate random solutions - - -```python -import numpy as np - -rng = np.random.default_rng(seed=1234) - -random_solution = {elem: rng.integers(2) for elem in g.nodes} - -print(f'The random solution is {random_solution}\n') -``` - - The random solution is {0: 1, 1: 1, 2: 1, 3: 0, 4: 0, 5: 1, 6: 0, 7: 0} - - - -### Check feasibility - - -```python -feasibility = mvc_feasibility(g, random_solution) -print(f'The feasibility is {feasibility}\n') -``` - - The feasibility is False - - - -### Fix broken constraints - - -```python -fixed_solution = mvc_easy_fix(g, random_solution) -print(f'After fixation, the solution is {fixed_solution}\n') -``` - - After fixation, the solution is {0: 1, 1: 1, 2: 1, 3: 0, 4: 1, 5: 1, 6: 1, 7: 0} - - - - -```python -feasibility = mvc_feasibility(g, fixed_solution) -print(f'The feasibility is {feasibility}\n') -``` - - The feasibility is True - - - -### Visualisation - - -```python -fig, (ax0, ax1) = plt.subplots(1, 2, figsize=(12.8,4.8)) -colour_b4fix = ['C1' if random_solution[n] else 'C0' for n in g.nodes] -colour_fixed = ['C1' if fixed_solution[n] else 'C0' for n in g.nodes] -nx.draw(g, pos, node_color=colour_b4fix, ax=ax0) -ax0.set_title(f'Vertex cover in orange before fix') -nx.draw(g, pos, node_color=colour_fixed, ax=ax1) -ax1.set_title(f'Vertex cover in orange after fix') -``` - - - - - Text(0.5, 1.0, 'Vertex cover in orange after fix') - - - - - - -### Calculate energy - - -```python -energy = mvc_energy(g, fixed_solution) -print(f'The energy is {energy}') -``` - - The energy is 3.2102004750256556 - - -## Hamiltonian of the MVC problem - - -```python -ham = hamiltonian_mvc(g, penalty=penalty, dense=True) -``` - - [Qibo 0.1.8|INFO|2022-11-01 10:26:19]: Using numpy backend on /CPU:0 - - -## Solve the hamiltonian with QAOA - - -```python -from qibo.models import QAOA - -# Create QAOA model -qaoa = QAOA(ham) - -# Optimize starting from a random guess for the variational parameters -initial_parameters = 0.01 * np.random.uniform(0,1,2) -best_energy, final_parameters, extra = qaoa.minimize(initial_parameters, method="BFGS") -``` - - [Qibo 0.1.8|WARNING|2022-10-31 14:14:37]: Calculating the dense form of a symbolic Hamiltonian. This operation is memory inefficient. diff --git a/examples/mvc/main.py b/examples/mvc/main.py deleted file mode 100755 index 2cfe3202f0..0000000000 --- a/examples/mvc/main.py +++ /dev/null @@ -1,82 +0,0 @@ -"""Minimum Vertex Cover""" - -import argparse -import csv - -import networkx as nx -from mvc import ( - hamiltonian_mvc, - mvc_easy_fix, - mvc_energy, - mvc_feasibility, - qubo_mvc, - qubo_mvc_penalty, -) -from qubo_utils import binary2spin, spin2QiboHamiltonian - -from qibo import callbacks, hamiltonians, models - -parser = argparse.ArgumentParser() -parser.add_argument("--filename", default="./mvc.csv", type=str) - - -def load_csv(filename: str): - """Load graph from csv file""" - with open(filename, newline="") as f: - reader = csv.reader(f) - data = [[int(row[0]), int(row[1]), float(row[2])] for row in reader] - - nodes = [k0 for k0, k1, v in data if k0 == k1] - edges = [[k0, k1] for k0, k1, v in data if k0 != k1] - - g = nx.Graph() - g.add_nodes_from(nodes) - g.add_edges_from(edges) - - node_weights = {k0: {"weight": v} for k0, k1, v in data if k0 == k1} - edge_weights = {(k0, k1): {"weight": v} for k0, k1, v in data if k0 != k1} - - nx.set_edge_attributes(g, edge_weights) - nx.set_node_attributes(g, node_weights) - - return g - - -def main(filename: str = "./mvc.csv"): - print(f"Load a graph from {filename} and make it a QUBO") - g = load_csv(filename) - penalty = qubo_mvc_penalty(g) - linear, quadratic = qubo_mvc(g, penalty=penalty) - - print("A random solution with seed 1234 must be infeasible") - import numpy as np - - rng = np.random.default_rng(seed=1234) - random_solution = {i: rng.integers(2) for i in g.nodes} - feasibility = mvc_feasibility(g, random_solution) - assert not feasibility, "The random solution should be infeasible." - - print("Make a naive fix to the violation of the constraint") - fixed_solution = mvc_easy_fix(g, random_solution) - feasibility = mvc_feasibility(g, fixed_solution) - assert feasibility, "The fixed solution should be feasible." - - print("Calculate the energy of the solution") - energy = mvc_energy(g, fixed_solution) - - print("Construct a hamiltonian based on the QUBO representation") - h, J, _ = binary2spin(linear, quadratic) - h = {k: -v for k, v in h.items()} - J = {k: -v for k, v in J.items()} - ham = spin2QiboHamiltonian(h, J) - - print("Construct a hamiltonian directly from a networkx graph") - ham = hamiltonian_mvc(g) - - print("done.") - - -if __name__ == "__main__": - # by defualt, test on the mvc.csv in the same directory - args = parser.parse_args() - main(args.filename) diff --git a/examples/mvc/mvc.csv b/examples/mvc/mvc.csv deleted file mode 100644 index 71ffdc6380..0000000000 --- a/examples/mvc/mvc.csv +++ /dev/null @@ -1,17 +0,0 @@ -0,0,0.4696822179283675 -1,1,0.6917392308135916 -2,2,0.7130420958314817 -3,3,0.49342677332980056 -4,4,0.49661600571433673 -5,5,0.55601135361347 -6,6,0.2831095711244086 -7,7,0.18737823232636885 -0,1,0.98602725407379 -1,2,0.935853268681996 -2,3,0.23080434023289664 -4,5,0.25521731195623476 -5,6,0.37096743935296606 -6,7,0.04408120693490547 -0,2,0.5619060764177991 -4,7,0.48402095290884917 -1,6,0.7106584134580318 diff --git a/examples/mvc/mvc.py b/examples/mvc/mvc.py deleted file mode 100644 index 2ef1eea5ae..0000000000 --- a/examples/mvc/mvc.py +++ /dev/null @@ -1,139 +0,0 @@ -import networkx as nx -from qubo_utils import binary2spin, spin2QiboHamiltonian - - -def qubo_mvc(g: nx.Graph, penalty=None): - """Given a graph g, return the QUBO of Minimum Vertex Cover (MVC) problem. - - If penalty is not given, it is inferred from g. - - Args: - g (nx.Graph): graph - penalty (float): penalty weight of the constraints - - Returns: - linear (Dict[Any, float]): linear terms - quadratic (Dict[(Any, Any), float]): quadratic terms - - """ - - q = {(k, k): v for k, v in g.nodes(data="weight")} - - if penalty is None: - penalty = qubo_mvc_penalty(g) - - for s, d in g.edges: - q[(s, s)] -= penalty - q[(d, d)] -= penalty - - if s > d: - s, d = d, s - - if (s, d) not in q: - q[(s, d)] = penalty - else: - q[(s, d)] += penalty - - linear = {k0: v for (k0, k1), v in q.items() if k0 == k1} - quadratic = {(k0, k1): v for (k0, k1), v in q.items() if k0 != k1 and v != 0} - - return linear, quadratic - - -def qubo_mvc_penalty(g: nx.Graph): - """Find appropriate penalty weight to ensure feasibility - - Args: - g (nx.Graph): graph - - Returns: - penalth (float): penalty - - """ - - # For NISQ devices, you cannot randomly choose a positive penalty weight, otherwise - # you get infeasible solutions very likely. If all weight equals to 1, - # set penalty to the largest degree will ensure high feasibility. - - highest_degree = max( - sum(g.nodes[k]["weight"] for k in g[i].keys()) for i in g.nodes() - ) - return highest_degree - - -def mvc_feasibility(g: nx.Graph, solution): - """Check if the solution violates the constraints of the problem - - Args: - g (nx.Graph): graph - solution (Dict[Any, int]): the solution - - Returns: - feasibility (bool): whether the solution meet the constraints - """ - for k0, k1 in g.edges: - if solution[k0] == solution[k1] == 0: - return False - return True - - -def mvc_energy(g: nx.Graph, solution): - """Calculate the energy of the solution on a MVC problem - - The result is based on the assumption that soltuion is feasible. - - Args: - g (nx.Graph): graph - solution (Dict[Any, int]): the solution - - Returns: - energy (float): the energy of the solution - """ - return sum(solution[k] * v for k, v in g.nodes.data("weight")) - - -def mvc_easy_fix(g: nx.Graph, solution): - """Naively fix violation in an out-of--place manner - - Args: - g (nx.Graph): graph - solution (Dict[Any, int]): the solution - - Returns: - solution (Dict[Any, int]): fixed solution - """ - - t = {k: v for k, v in solution.items()} - - for k0, k1 in g.edges: - if t[k0] == t[k1] == 0: - t[k0] = 1 - - return t - - -def hamiltonian_mvc(g: nx.Graph, penalty: float = None, dense: bool = False): - """Given a graph g, return the hamiltonian of Minimum Vertex Cover (MVC) - problem. - - If penalty is not given, it is inferred from g. - - Args: - g (nx.Graph): graph - penalty (float): penalty weight of the constraints - dense (bool): sparse or dense hamiltonian - - Returns: - ham: qibo hamiltonian - - """ - - linear, quadratic = qubo_mvc(g, penalty) - - h, J, _ = binary2spin(linear, quadratic) - h = {k: -v for k, v in h.items()} - J = {k: -v for k, v in J.items()} - - ham = spin2QiboHamiltonian(h, J, dense=dense) - - return ham diff --git a/examples/mvc/qubo_utils.py b/examples/mvc/qubo_utils.py deleted file mode 100644 index 1c99798e28..0000000000 --- a/examples/mvc/qubo_utils.py +++ /dev/null @@ -1,123 +0,0 @@ -from typing import Dict, Tuple - - -def binary2spin( - linear: Dict[int, float], - quadratic: Dict[Tuple[int, int], float], - offset: float = 0, -): - """Convert binary model to spin model - - Please remember to put a negative sign to h and J after using this - function , if you are going to form a mamiltonian from the spin - model. Hamiltonians usually have a leading negative sign in them, - but QUBOs don't. - - Args: - linear (dict): linear term of the binary model - quadratic (dict): quadratic term of the binary model - offset (float): offset of the binary model - - Returns: - h (dict): bias of the spin model - J (dict): interaction of the spin model - offset (float): offset of the spin model - """ - - h = {x: 0.5 * w for x, w in linear.items()} - - J = [] - for (x, y), w in quadratic.items(): - J.append(((x, y), 0.25 * w)) - h[x] += 0.25 * w - h[y] += 0.25 * w - J = dict(J) - - offset += 0.5 * sum(linear.values()) - offset += 0.25 * sum(quadratic.values()) - - return h, J, offset - - -def spin2binary( - h: Dict[int, float], - J: Dict[Tuple[int, int], float], - offset: float = 0, -): - """Convert spin model to binary model - - Please remember to put a negative sign to h and J before using this - function if you extract them from a hamiltonian. Hamiltonians - usually have a leading negative sign in them, but QUBOs don't. - - Args: - h (dict): bias of the spin model - J (dict): interaction of the spin model - offset (float): offset of the spin model - - Returns: - linear (dict): linear term of the binary model - quadratic (dict): quadratic term of the binary model - offset (float): offset of the binary model - """ - - linear = {s: 2.0 * bias for s, bias in h.items()} - - quadratic = [] - for (s, t), bias in J.items(): - quadratic.append(((s, t), 4.0 * bias)) - linear[s] -= 2.0 * bias - linear[t] -= 2.0 * bias - quadratic = dict(quadratic) - - offset -= sum(linear.values()) - offset += sum(quadratic.values()) - - return linear, quadratic, offset - - -def spin2QiboHamiltonian( - h: Dict[int, float], - J: Dict[Tuple[int, int], float], - dense: bool = True, -): - """Convert spin model to qibo Hamiltonian - - Mixer is not included. - - Please remember to put a negative sign to h and J if you get h and J - from binary2spin. Hamiltonians usually have a leading negative sign - in them, but QUBOs don't. - - .. math:: - H = - \\sum_{i=0}^N \\sum _{j=0}^N J_{ij} Z_i Z_j - \\sum_{i=0}^N h_i Z_i. - - Args: - h (dict): bias of the spin model - J (dict): interaction of the spin model - dense (bool): If ``True`` it creates the Hamiltonian as a - :class:`qibo.core.hamiltonians.Hamiltonian`, otherwise it creates - a :class:`qibo.core.hamiltonians.SymbolicHamiltonian`. - - Returns: - linear (dict): linear term of the binary model - quadratic (dict): quadratic term of the binary model - offset (float): offset of the binary model - """ - - from qibo.hamiltonians import SymbolicHamiltonian - from qibo.symbols import Z - - symbolic_ham = sum(Z(k, commutative=True) * v for k, v in h.items()) - symbolic_ham += sum( - Z(k0, commutative=True) * Z(k1, commutative=True) * v - for (k0, k1), v in J.items() - ) - symbolic_ham = -symbolic_ham - - ham = SymbolicHamiltonian(symbolic_ham) - - if dense: - return ham.dense - - return ham diff --git a/examples/qap/README.md b/examples/qap/README.md deleted file mode 100644 index cda5b06f0e..0000000000 --- a/examples/qap/README.md +++ /dev/null @@ -1,177 +0,0 @@ -# Quadratic assignment problem (QAP) - -Code at: [https://github.com/qiboteam/qibo/tree/master/examples/qap](https://github.com/qiboteam/qibo/tree/master/examples/qap) - -The quadratic assignment problem (QAP) is an important combinatorial optimization problems that was first introduced by Koopmans and Beckmann. The objective of the problem is to assign a set of facilities to a set of locations in such a way as to minimize the total assignment cost. The assignment cost for a pair of facilities is a function of the flow between the facilities and the distance between the locations of the facilities. - -```python -import numpy as np - -from qap import qubo_qap, qubo_qap_penalty, qubo_qap_feasibility, qubo_qap_energy, hamiltonian_qap - -def load_qap(filename): - """Load qap problem from a file - - The file format is compatible with the one used in QAPLIB - - """ - - with open(filename, 'r') as fh: - n = int(fh.readline()) - - numbers = [float(n) for n in fh.read().split()] - - data = np.asarray(numbers).reshape(2, n, n) - f = data[1] - d = data[0] - - i = range(len(f)) - f[i, i] = 0 - d[i, i] = 0 - - return f, d -``` - -## Load QAP problem from a file - - -```python -F, D = load_qap('tiny04a.dat') -print(f'The QAP instance is:') -print(F) -print(D) -``` - - The QAP instance is: - [[0. 0.29541331 0.68442855 0.19882279] - [0.29541331 0. 0.61649225 0.16210679] - [0.68442855 0.61649225 0. 0.73052088] - [0.19882279 0.16210679 0.73052088 0. ]] - [[0. 0.77969778 0.43045022 0.43294055] - [0.77969778 0. 0.1920096 0.58829618] - [0.43045022 0.1920096 0. 0.47901122] - [0.43294055 0.58829618 0.47901122 0. ]] - - -## Calculate the penalty - - -```python -penalty = qubo_qap_penalty((F, D)) -print(f'The penalty is {penalty}') -``` - - The penalty is 2.2783420340595995 - - -## Formulate the QUBO - - -```python -linear, quadratic, offset = qubo_qap((F, D), penalty=penalty) -print(f'linear: {linear}') -print() -print(f'quadratic: {quadratic}') -print() -print(f'offset: {offset}\n') -``` - - linear: {0: -4.556684, 1: -4.556684, 2: -4.556684, 3: -4.556684, 4: -4.556684, 5: -4.556684, 6: -4.556684, 7: -4.556684, 8: -4.556684, 9: -4.556684, 10: -4.556684, 11: -4.556684, 12: -4.556684, 13: -4.556684, 14: -4.556684, 15: -4.556684} - - quadratic: {(1, 0): 2.278342, (2, 0): 2.278342, (3, 0): 2.278342, (4, 0): 2.278342, (5, 0): 0.2303331, (6, 0): 0.12716073, (7, 0): 0.1278964, (8, 0): 2.278342, (9, 0): 0.5336474, (10, 0): 0.2946124, (11, 0): 0.29631686, (12, 0): 2.278342, (13, 0): 0.15502168, (14, 0): 0.085583314, (15, 0): 0.08607845, (2, 1): 2.278342, (3, 1): 2.278342, (4, 1): 0.2303331, (5, 1): 2.278342, (6, 1): 0.05672219, (7, 1): 0.17379051, (8, 1): 0.5336474, (9, 1): 2.278342, (10, 1): 0.13141686, (11, 1): 0.4026467, (12, 1): 0.15502168, (13, 1): 2.278342, (14, 1): 0.038175885, (15, 1): 0.11696669, (3, 2): 2.278342, (4, 2): 0.12716073, (5, 2): 0.05672219, (6, 2): 2.278342, (7, 2): 0.14150628, (8, 2): 0.2946124, (9, 2): 0.13141686, (10, 2): 2.278342, (11, 2): 0.32784894, (12, 2): 0.085583314, (13, 2): 0.038175885, (14, 2): 2.278342, (15, 2): 0.09523835, (4, 3): 0.1278964, (5, 3): 0.17379051, (6, 3): 0.14150628, (7, 3): 2.278342, (8, 3): 0.29631686, (9, 3): 0.4026467, (10, 3): 0.32784894, (11, 3): 2.278342, (12, 3): 0.08607845, (13, 3): 0.11696669, (14, 3): 0.09523835, (15, 3): 2.278342, (5, 4): 2.278342, (6, 4): 2.278342, (7, 4): 2.278342, (8, 4): 2.278342, (9, 4): 0.48067763, (10, 4): 0.2653692, (11, 4): 0.2669045, (12, 4): 2.278342, (13, 4): 0.1263943, (14, 4): 0.069778904, (15, 4): 0.0701826, (6, 5): 2.278342, (7, 5): 2.278342, (8, 5): 0.48067763, (9, 5): 2.278342, (10, 5): 0.11837243, (11, 5): 0.36268005, (12, 5): 0.1263943, (13, 5): 2.278342, (14, 5): 0.03112606, (15, 5): 0.095366806, (7, 6): 2.278342, (8, 6): 0.2653692, (9, 6): 0.11837243, (10, 6): 2.278342, (11, 6): 0.2953067, (12, 6): 0.069778904, (13, 6): 0.03112606, (14, 6): 2.278342, (15, 6): 0.07765097, (8, 7): 0.2669045, (9, 7): 0.36268005, (10, 7): 0.2953067, (11, 7): 2.278342, (12, 7): 0.0701826, (13, 7): 0.095366806, (14, 7): 0.07765097, (15, 7): 2.278342, (9, 8): 2.278342, (10, 8): 2.278342, (11, 8): 2.278342, (12, 8): 2.278342, (13, 8): 0.5695855, (14, 8): 0.31445286, (15, 8): 0.3162721, (10, 9): 2.278342, (11, 9): 2.278342, (12, 9): 0.5695855, (13, 9): 2.278342, (14, 9): 0.14026703, (15, 9): 0.42976263, (11, 10): 2.278342, (12, 10): 0.31445286, (13, 10): 0.14026703, (14, 10): 2.278342, (15, 10): 0.3499277, (12, 11): 0.3162721, (13, 11): 0.42976263, (14, 11): 0.3499277, (15, 11): 2.278342, (13, 12): 2.278342, (14, 12): 2.278342, (15, 12): 2.278342, (14, 13): 2.278342, (15, 13): 2.278342, (15, 14): 2.278342} - - offset: 18.226736272476796 - - - -## Generate a random solution and check its feasibility - - -```python -rng = np.random.default_rng(seed=1234) -random_solution = {key: rng.integers(2) for key in range(F.size)} -print(f'The random solution is {random_solution}\n') -``` - - The random solution is {0: 1, 1: 1, 2: 1, 3: 0, 4: 0, 5: 1, 6: 0, 7: 0, 8: 0, 9: 0, 10: 1, 11: 0, 12: 1, 13: 0, 14: 1, 15: 0} - - - - -```python -feasibility = qubo_qap_feasibility((F, D), random_solution) -print(f'The feasibility of the random solution is {feasibility}\n') -``` - - The feasibility of the random solution is False - - - -## Generate a feasible solution and check its feasibility - - -```python -feasible_solution = np.zeros(F.shape) -sequence = np.arange(F.shape[0]) -np.random.shuffle(sequence) -for elem in range(F.shape[0]): - feasible_solution[elem, sequence[elem]] = 1 -feasible_solution = {k:v for k, v in enumerate(feasible_solution.flatten())} -print(f'The feasible solution is {feasible_solution}\n') -``` - - The feasible solution is {0: 0.0, 1: 0.0, 2: 1.0, 3: 0.0, 4: 0.0, 5: 0.0, 6: 0.0, 7: 1.0, 8: 0.0, 9: 1.0, 10: 0.0, 11: 0.0, 12: 1.0, 13: 0.0, 14: 0.0, 15: 0.0} - - - - -```python -feasibility = qubo_qap_feasibility((F, D), feasible_solution) -print(f'The feasibility of the feasible solution is {feasibility}\n') -``` - - The feasibility of the feasible solution is True - - - -## Calculate the energy of the feasible solution - - -```python -energy = qubo_qap_energy((F,D), feasible_solution) -print(f'The energy of the feasible solution is {energy}') -``` - - The energy of the feasible solution is 2.7219091992575177 - - -## Hamiltonian - - -```python -ham = hamiltonian_qap((F, D), dense=False) -``` - - [Qibo 0.1.6|INFO|2022-05-31 14:47:26]: Using qibojit backend on /GPU:0 - - -## Solve the Hamiltonian with QAOA - -QAP of size 4 is too large for Qibo QAOA. Let's reduce the size to 3 - - -```python -ham = hamiltonian_qap((F[:3,:3], D[:3,:3]), dense=False) - - -from qibo.models import QAOA - -# Create QAOA model -qaoa = models.QAOA(ham) - -# Optimize starting from a random guess for the variational parameters -initial_parameters = 0.01 * np.random.uniform(0,1,2) -best_energy, final_parameters, extra = qaoa.minimize(initial_parameters, method="BFGS") -``` - - [Qibo 0.1.8|WARNING|2022-10-31 14:14:37]: Calculating the dense form of a symbolic Hamiltonian. This operation is memory inefficient. diff --git a/examples/qap/main.py b/examples/qap/main.py deleted file mode 100755 index 66146ddf11..0000000000 --- a/examples/qap/main.py +++ /dev/null @@ -1,79 +0,0 @@ -"""Quadratic Assignment Problem""" - -import argparse - -import numpy as np -from qap import ( - hamiltonian_qap, - qubo_qap, - qubo_qap_energy, - qubo_qap_feasibility, - qubo_qap_penalty, -) -from qubo_utils import binary2spin, spin2QiboHamiltonian - -parser = argparse.ArgumentParser() -parser.add_argument("--filename", default="./tiny04a.dat", type=str) - - -def load_qap(filename): - """Load qap problem from a file - - The file format is compatible with the one used in QAPLIB - - """ - - with open(filename) as fh: - n = int(fh.readline()) - - numbers = [float(n) for n in fh.read().split()] - - data = np.asarray(numbers).reshape(2, n, n) - f = data[1] - d = data[0] - - i = range(len(f)) - f[i, i] = 0 - d[i, i] = 0 - - return f, d - - -def main(filename: str = "./tiny04a.dat"): - print(f"Load flow and distance matrices from {filename} and make a QUBO") - F, D = load_qap(filename) - penalty = qubo_qap_penalty((F, D)) - - linear, quadratic, offset = qubo_qap((F, D), penalty=penalty) - - print("A random solution with seed 1234 must be infeasible") - import numpy as np - - rng = np.random.default_rng(seed=1234) - random_solution = {i: rng.integers(2) for i in range(F.size)} - feasibility = qubo_qap_feasibility((F, D), random_solution) - assert not feasibility, "The random solution should be infeasible." - - print("Generate a feasible solution and check its feasibility") - feasible_solution = np.zeros(F.shape) - sequence = np.arange(F.shape[0]) - np.random.shuffle(sequence) - for i in range(F.shape[0]): - feasible_solution[i, sequence[i]] = 1 - feasible_solution = {k: v for k, v in enumerate(feasible_solution.flatten())} - feasibility = qubo_qap_feasibility((F, D), feasible_solution) - assert feasibility, "The fixed solution should be feasible." - - print("Calculate the energy of the solution") - energy = qubo_qap_energy((F, D), feasible_solution) - - print("Construct a hamiltonian directly from flow and distance matrices") - ham = hamiltonian_qap((F, D), dense=False) - - print("done.") - - -if __name__ == "__main__": - # by defualt, test on the mvc.csv in the same directory - args = parser.parse_args() - main(args.filename) diff --git a/examples/qap/qap.py b/examples/qap/qap.py deleted file mode 100644 index 1efecae8e9..0000000000 --- a/examples/qap/qap.py +++ /dev/null @@ -1,138 +0,0 @@ -from typing import Any, Dict, Tuple - -import numpy as np -from qubo_utils import binary2spin, spin2QiboHamiltonian - - -def qubo_qap(g: Tuple[np.ndarray, np.ndarray], penalty: float = None): - """Given adjacency matrix of flow and distance, formulate the QUBO of - Quadratic Assignment Problem (QAP) - - Args: - g: the adjacency matrices of flow and distance that describe the QAP - penalty: penalty weight for the constraints, if not given, it - is inferred from the adjacency matrices - - Returns: - linear (Dict[Any, float]): linear terms - quadratic (Dict[(Any, Any), float]): quadratic terms - offset (float): the constant term - """ - - flow, distance = g - n = len(flow) - q = np.einsum("ij,kl->ikjl", flow, distance) - - if penalty is None: - penalty = qubo_qap_penalty(g) - - i = range(len(q)) - q[i, :, i, :] += 1 * penalty - q[i, :, i, :] -= 2 * penalty * np.eye(n) - q[:, i, :, i] += 1 * penalty - q[:, i, :, i] -= 2 * penalty * np.eye(n) - - q = q.reshape(n**2, n**2).astype(np.float32) - - offset = penalty * 2 * n - linear = {i: q[i, i] for i in range(q.shape[0])} - quadratic = { - (i, j): q[i, j] for j in range(q.shape[1]) for i in range(q.shape[0]) if i > j - } - - return linear, quadratic, offset - - -def qubo_qap_penalty(g: Tuple[np.ndarray, np.ndarray]): - """Find appropriate penalty weight to ensure feasibility - - Args: - g: the adjacency matrices of flow and distance that describe the QAP - - Returns: - penalty (float): penalty weight for the constraints - """ - F, D = g - q = np.einsum("ij,kl->ikjl", F, D) - return F.shape[0] * np.abs(q).max() - - -def qubo_qap_feasibility(g: Tuple[np.ndarray, np.ndarray], solution: Dict[Any, int]): - """Check if the solution violates the constraints of the problem - - Args: - g: the adjacency matrices of flow and distance that describe the QAP - solution (Dict[Any, int]): the binary solution - - Returns: - feasibility (bool): whether the solution meet the constraints - """ - F, D = g - - solution = [[k, v] for k, v in solution.items()] - solution.sort(key=lambda x: x[0]) - _, vals = zip(*solution) - vals = np.asarray(vals).reshape(F.shape) - - assert np.all( - np.logical_or(vals == 0, vals == 1) - ), "Decision variable must be 0 or 1" - return np.all(vals.sum(axis=0) == 1) and np.all(vals.sum(axis=1) == 1) - - -def qubo_qap_energy(g: Tuple[np.ndarray, np.ndarray], solution: Dict[Any, int]): - """Calculate the energy of the solution on a QAP problem - The result is based on the assumption that soltuion is feasible. - - Args: - g: the adjacency matrices of flow and distance that describe the QAP - solution (Dict[Any, int]): the solution - - Returns: - energy (float): the energy of the solution - """ - - F, D = g - - solution = [[k, v] for k, v in solution.items()] - solution.sort(key=lambda x: x[0]) - _, vals = zip(*solution) - vals = np.asarray(vals).reshape(F.shape) - - state = np.vstack(np.where(vals == 1)).T - state = np.array(state).astype(np.int32) - energy = 0 - for i in range(len(state)): - energy += np.einsum( - "i,i->", F[state[i, 0], state[:, 0]], D[state[i, 1], state[:, 1]] - ) - return energy - - -def hamiltonian_qap( - g: Tuple[np.ndarray, np.ndarray], penalty: float = None, dense: bool = False -): - """Given a flow and distance matrices, return the hamiltonian of Quadratic - Assignment Problem (QAP). - - If penalty is not given, it is inferred from g. - - Args: - g (Tuple[np.ndarray, np.ndarray]): flow and distance matrices - penalty (float): penalty weight of the constraints - dense (bool): sparse or dense hamiltonian - - Returns: - ham: qibo hamiltonian - - """ - - linear, quadratic, offset = qubo_qap(g, penalty) - - h, J, _ = binary2spin(linear, quadratic) - h = {k: -v for k, v in h.items()} - J = {k: -v for k, v in J.items()} - - ham = spin2QiboHamiltonian(h, J, dense=dense) - - return ham diff --git a/examples/qap/qubo_utils.py b/examples/qap/qubo_utils.py deleted file mode 100644 index 0c3253ef91..0000000000 --- a/examples/qap/qubo_utils.py +++ /dev/null @@ -1,122 +0,0 @@ -from typing import Dict, Tuple - - -def binary2spin( - linear: Dict[int, float], - quadratic: Dict[Tuple[int, int], float], - offset: float = 0, -): - """Convert binary model to spin model - - Please remember to put a negative sign to h and J after using this - function , if you are going to form a mamiltonian from the spin - model. Hamiltonians usually have a leading negative sign in them, - but QUBOs don't. - - Args: - linear (dict): linear term of the binary model - quadratic (dict): quadratic term of the binary model - offset (float): offset of the binary model - - Returns: - h (dict): bias of the spin model - J (dict): interaction of the spin model - offset (float): offset of the spin model - """ - - h = {x: 0.5 * w for x, w in linear.items()} - - J = [] - for (x, y), w in quadratic.items(): - J.append(((x, y), 0.25 * w)) - h[x] += 0.25 * w - h[y] += 0.25 * w - J = dict(J) - - offset += 0.5 * sum(linear.values()) - offset += 0.25 * sum(quadratic.values()) - - return h, J, offset - - -def spin2binary( - h: Dict[int, float], - J: Dict[Tuple[int, int], float], - offset: float = 0, -): - """Convert spin model to binary model - - Please remember to put a negative sign to h and J before using this - function if you extract them from a hamiltonian. Hamiltonians - usually have a leading negative sign in them, but QUBOs don't. - - Args: - h (dict): bias of the spin model - J (dict): interaction of the spin model - offset (float): offset of the spin model - - Returns: - linear (dict): linear term of the binary model - quadratic (dict): quadratic term of the binary model - offset (float): offset of the binary model - """ - - linear = {s: 2.0 * bias for s, bias in h.items()} - - quadratic = [] - for (s, t), bias in J.items(): - quadratic.append(((s, t), 4.0 * bias)) - linear[s] -= 2.0 * bias - linear[t] -= 2.0 * bias - quadratic = dict(quadratic) - - offset -= sum(linear.values()) - offset += sum(quadratic.values()) - - return linear, quadratic, offset - - -def spin2QiboHamiltonian( - h: Dict[int, float], - J: Dict[Tuple[int, int], float], - dense: bool = True, -): - """Convert spin model to qibo Hamiltonian - - Mixer is not included. - - Please remember to put a negative sign to h and J if you get h and J - from binary2spin. Hamiltonians usually have a leading negative sign - in them, but QUBOs don't. - - .. math:: - H = - \\sum_{i=0}^N \\sum _{j=0}^N J_{ij} Z_i Z_j - \\sum_{i=0}^N h_i Z_i. - - Args: - h (dict): bias of the spin model - J (dict): interaction of the spin model - dense (bool): If ``True`` it creates the Hamiltonian as a - :class:`qibo.core.hamiltonians.Hamiltonian`, otherwise it creates - a :class:`qibo.core.hamiltonians.SymbolicHamiltonian`. - - Returns: - linear (dict): linear term of the binary model - quadratic (dict): quadratic term of the binary model - offset (float): offset of the binary model - """ - - from qibo.hamiltonians import SymbolicHamiltonian - from qibo.symbols import Z - - form = 0 - for k, v in h.items(): - form -= Z(k, commutative=True) * v - for (k0, k1), v in J.items(): - form -= Z(k0, commutative=True) * Z(k1, commutative=True) * v - - ham = SymbolicHamiltonian(form) - - if dense: - return ham.dense - - return ham diff --git a/examples/qap/tiny04a.dat b/examples/qap/tiny04a.dat deleted file mode 100644 index 39661414a2..0000000000 --- a/examples/qap/tiny04a.dat +++ /dev/null @@ -1,11 +0,0 @@ -4 - -0.0 0.7796977849571155 0.4304502176328382 0.4329405547124155 -0.7796977849571155 0.0 0.1920096021905386 0.5882961822495594 -0.4304502176328382 0.1920096021905386 0.0 0.47901121613954656 -0.4329405547124155 0.5882961822495594 0.47901121613954656 0.0 - -0.0 0.29541330831110774 0.6844285463729066 0.1988227908746449 -0.29541330831110774 0.0 0.6164922460559509 0.16210678581988341 -0.6844285463729066 0.6164922460559509 0.0 0.7305208755290076 -0.1988227908746449 0.16210678581988341 0.7305208755290076 0.0 diff --git a/src/qibo/models/__init__.py b/src/qibo/models/__init__.py index 4eb3ccf0c7..0ac06f8d0a 100644 --- a/src/qibo/models/__init__.py +++ b/src/qibo/models/__init__.py @@ -1,4 +1,4 @@ -from qibo.models import hep, tsp +from qibo.models import hep from qibo.models.circuit import Circuit from qibo.models.encodings import ( binary_encoder, diff --git a/src/qibo/models/tsp.py b/src/qibo/models/tsp.py deleted file mode 100644 index 028059da37..0000000000 --- a/src/qibo/models/tsp.py +++ /dev/null @@ -1,184 +0,0 @@ -import numpy as np - -from qibo import gates -from qibo.hamiltonians import SymbolicHamiltonian -from qibo.models.circuit import Circuit -from qibo.symbols import X, Y, Z - - -def calculate_two_to_one(num_cities): - return np.arange(num_cities**2).reshape(num_cities, num_cities) - - -def tsp_phaser(distance_matrix, backend=None): - num_cities = distance_matrix.shape[0] - two_to_one = calculate_two_to_one(num_cities) - form = 0 - for city_i in range(num_cities): - for city_u in range(num_cities): - for city_v in range(num_cities): - if city_u != city_v: - form += ( - distance_matrix[city_u, city_v] - * Z(int(two_to_one[city_u, city_i]), backend=backend) - * Z( - int(two_to_one[city_v, (city_i + 1) % num_cities]), - backend=backend, - ) - ) - ham = SymbolicHamiltonian(form, backend=backend) - return ham - - -def tsp_mixer(num_cities, backend=None): - two_to_one = calculate_two_to_one(num_cities) - splus = lambda u, i: X(int(two_to_one[u, i]), backend=backend) + 1j * Y( - int(two_to_one[u, i]), backend=backend - ) - sminus = lambda u, i: X(int(two_to_one[u, i]), backend=backend) - 1j * Y( - int(two_to_one[u, i]), backend=backend - ) - form = 0 - for city_i in range(num_cities): - for city_u in range(num_cities): - for city_v in range(num_cities): - if city_u != city_v: - form += splus(city_u, city_i) * splus( - city_v, (city_i + 1) % num_cities - ) * sminus(city_u, (city_i + 1) % num_cities) * sminus( - city_v, city_i - ) + sminus( - city_u, city_i - ) * sminus( - city_v, (city_i + 1) % num_cities - ) * splus( - city_u, (city_i + 1) % num_cities - ) * splus( - city_v, city_i - ) - ham = SymbolicHamiltonian(form, backend=backend) - return ham - - -class TSP: - """ - The travelling salesman problem (also called the travelling salesperson problem or TSP) - asks the following question: "Given a list of cities and the distances between each pair of cities, - what is the shortest possible route for a salesman to visit each city exactly once and return to the origin city?" - It is an NP-hard problem in combinatorial optimization. It is also important in theoretical computer science and - operations research. - - This is a TSP class that enables us to implement TSP according to - `arxiv:1709.03489 `_ by Hadfield (2017). - - Args: - distance_matrix: a numpy matrix encoding the distance matrix. - backend: Backend to use for calculations. If not given the global backend will be used. - - Example: - .. testcode:: - - from qibo.models.tsp import TSP - import numpy as np - from collections import defaultdict - from qibo import gates - from qibo.models import QAOA - from qibo.result import CircuitResult - - - def convert_to_standard_Cauchy(config): - m = int(np.sqrt(len(config))) - cauchy = [-1] * m # Cauchy's notation for permutation, e.g. (1,2,0) or (2,0,1) - for i in range(m): - for j in range(m): - if config[m * i + j] == '1': - cauchy[j] = i # citi i is in slot j - for i in range(m): - if cauchy[i] == 0: - cauchy = cauchy[i:] + cauchy[:i] - return tuple(cauchy) # now, the cauchy notation for permutation begins with 0 - - - def evaluate_dist(cauchy): - ''' - Given a permutation of 0 to n-1, we compute the distance of the tour - - ''' - m = len(cauchy) - return sum(distance_matrix[cauchy[i]][cauchy[(i+1)%m]] for i in range(m)) - - - def qaoa_function_of_layer(layer, distance_matrix): - ''' - This is a function to study the impact of the number of layers on QAOA, it takes - in the number of layers and compute the distance of the mode of the histogram obtained - from QAOA - - ''' - small_tsp = TSP(distance_matrix) - obj_hamil, mixer = small_tsp.hamiltonians() - qaoa = QAOA(obj_hamil, mixer=mixer) - best_energy, final_parameters, extra = qaoa.minimize(initial_p=[0.1] * layer, - initial_state=initial_state, method='BFGS') - qaoa.set_parameters(final_parameters) - quantum_state = qaoa.execute(initial_state) - circuit = Circuit(9) - circuit.add(gates.M(*range(9))) - result = CircuitResult(quantum_state, circuit.measurements, small_tsp.backend, nshots=1000) - freq_counter = result.frequencies() - # let's combine freq_counter here, first convert each key and sum up the frequency - cauchy_dict = defaultdict(int) - for freq_key in freq_counter: - standard_cauchy_key = convert_to_standard_Cauchy(freq_key) - cauchy_dict[standard_cauchy_key] += freq_counter[freq_key] - max_key = max(cauchy_dict, key=cauchy_dict.get) - return evaluate_dist(max_key) - - np.random.seed(42) - num_cities = 3 - distance_matrix = np.array([[0, 0.9, 0.8], [0.4, 0, 0.1],[0, 0.7, 0]]) - distance_matrix = distance_matrix.round(1) - small_tsp = TSP(distance_matrix) - initial_parameters = np.random.uniform(0, 1, 2) - initial_state = small_tsp.prepare_initial_state([i for i in range(num_cities)]) - qaoa_function_of_layer(2, distance_matrix) - - """ - - def __init__(self, distance_matrix, backend=None): - from qibo.backends import _check_backend - - self.backend = _check_backend(backend) - - self.distance_matrix = distance_matrix - self.num_cities = distance_matrix.shape[0] - self.two_to_one = calculate_two_to_one(self.num_cities) - - def hamiltonians(self): - """ - Returns: - The pair of Hamiltonian describes the phaser hamiltonian - and the mixer hamiltonian. - - """ - return ( - tsp_phaser(self.distance_matrix, backend=self.backend), - tsp_mixer(self.num_cities, backend=self.backend), - ) - - def prepare_initial_state(self, ordering): - """ - To run QAOA by Hadsfield, we need to start from a valid permutation function to ensure feasibility. - - Args: - ordering (array): A list describing permutation from 0 to n-1 - - Returns: - An initial state that is used to start TSP QAOA. - - """ - circuit = Circuit(len(ordering) ** 2) - for order in range(len(ordering)): - circuit.add(gates.X(int(self.two_to_one[ordering[order], order]))) - result = self.backend.execute_circuit(circuit) - return result.state() diff --git a/tests/regressions/tsp_layer2_imag.out b/tests/regressions/tsp_layer2_imag.out deleted file mode 100644 index 754d67be3e..0000000000 --- a/tests/regressions/tsp_layer2_imag.out +++ /dev/null @@ -1,512 +0,0 @@ -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -1.034267702652136951e-07 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 --1.125407363285722828e-08 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -8.175715411600245706e-04 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 --5.513468058776938713e-05 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -7.347588697741100523e-03 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 --1.097722566296985974e-01 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 diff --git a/tests/regressions/tsp_layer2_real.out b/tests/regressions/tsp_layer2_real.out deleted file mode 100644 index a6258ded5d..0000000000 --- a/tests/regressions/tsp_layer2_real.out +++ /dev/null @@ -1,512 +0,0 @@ -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -1.142305492602130386e-08 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -1.018967776766042943e-07 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 --7.402466722830055267e-03 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 --6.089395260702398522e-06 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -8.115104924275230074e-04 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -9.939013723965425262e-01 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 diff --git a/tests/regressions/tsp_layer4_imag.out b/tests/regressions/tsp_layer4_imag.out deleted file mode 100644 index 21ac4437ed..0000000000 --- a/tests/regressions/tsp_layer4_imag.out +++ /dev/null @@ -1,512 +0,0 @@ -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -1.453194996748716108e-09 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -6.283711317120813100e-12 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -8.738304561841873428e-06 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 --1.012061297980901969e-07 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -2.668345483198655485e-03 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 --2.182302544452734694e-01 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 diff --git a/tests/regressions/tsp_layer4_real.out b/tests/regressions/tsp_layer4_real.out deleted file mode 100644 index 6143ea496a..0000000000 --- a/tests/regressions/tsp_layer4_real.out +++ /dev/null @@ -1,512 +0,0 @@ -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -6.017462797455740175e-10 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 --2.430347448897224316e-11 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 --3.907637459246790111e-05 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 --4.249523260157431898e-08 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -1.120417515571634935e-03 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -9.758930161848613505e-01 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 -0.000000000000000000e+00 diff --git a/tests/test_models_tsp.py b/tests/test_models_tsp.py deleted file mode 100644 index 8ba144eeac..0000000000 --- a/tests/test_models_tsp.py +++ /dev/null @@ -1,74 +0,0 @@ -import pathlib - -import numpy as np -import pytest - -from qibo.models import QAOA -from qibo.models.tsp import TSP - -REGRESSION_FOLDER = pathlib.Path(__file__).with_name("regressions") - - -def assert_regression_fixture(backend, array, filename, rtol=1e-5, atol=1e-12): - """Check array matches data inside filename. - - Args: - array: numpy array/ - filename: fixture filename - - If filename does not exists, this function - creates the missing file otherwise it loads - from file and compare. - """ - - def load(filename): - return np.loadtxt(filename) - - filename = REGRESSION_FOLDER / filename - try: - array_fixture = load(filename) - except: # pragma: no cover - # case not tested in GitHub workflows because files exist - np.savetxt(filename, array) - array_fixture = load(filename) - backend.assert_allclose(array, array_fixture, rtol=rtol, atol=atol) - - -def qaoa_function_of_layer(backend, layer): - """ - This is a function to study the impact of the number of layers on QAOA, it takes - in the number of layers and compute the distance of the mode of the histogram obtained - from QAOA - """ - num_cities = 3 - distance_matrix = np.array([[0, 0.9, 0.8], [0.4, 0, 0.1], [0, 0.7, 0]]) - # there are two possible cycles, one with distance 1, one with distance 1.9 - distance_matrix = distance_matrix.round(1) - - small_tsp = TSP(distance_matrix, backend=backend) - initial_state = small_tsp.prepare_initial_state([i for i in range(num_cities)]) - obj_hamil, mixer = small_tsp.hamiltonians() - qaoa = QAOA(obj_hamil, mixer=mixer) - initial_state = backend.cast(initial_state, copy=True) - best_energy, final_parameters, extra = qaoa.minimize( - initial_p=[0.1 for i in range(layer)], - initial_state=initial_state, - method="BFGS", - options={"maxiter": 1}, - ) - qaoa.set_parameters(final_parameters) - return qaoa.execute(initial_state) - - -@pytest.mark.parametrize("nlayers", [2, 4]) -def test_tsp(backend, nlayers): - # if nlayers == 4 and backend.platform in ("cupy", "cuquantum"): - # pytest.skip("Failing for cupy and cuquantum.") - final_state = backend.to_numpy(qaoa_function_of_layer(backend, nlayers)) - atol = 4e-5 if backend.platform in ("cupy", "cuquantum") else 1e-5 - assert_regression_fixture( - backend, final_state.real, f"tsp_layer{nlayers}_real.out", rtol=1e-3, atol=atol - ) - assert_regression_fixture( - backend, final_state.imag, f"tsp_layer{nlayers}_imag.out", rtol=1e-3, atol=atol - )