scieee AI-readable full text Open interactive document viewer

Analysis of performance of the Chordal Branch and Bound algorithm

García Hernández, Álvaro

Abstract

In the era of quantum technology, benchmarking classical algorithms is necessary for certifying the results given by the quantum device to the optimization problem that is wanted to solve. Here we analyse a new algorithm that gives an upper and a lower bound to the ground state solution of Ising type optimization problems. We test its performance in solution planted problems and compare it with simulated annealing, a common algorithm to solve optimization problems, getting in general more reliable results in the same amount of time. Additionally, we verify the tunable hardness of the planting schemes used to generate the optimization problems.

Full text

MSc in Photonics PHOTONICSBCN Universitat Politècnica de Catalunya (UPC) Universitat Autònoma de Barcelona (UAB) Universitat de Barcelona (UB) Institut de Ciències Fotòniques (ICFO) http://www.photonicsbcn.eu Master in Photonics MASTER THESIS WORK Analysis of performance of the Chordal Branch and Bound algorithm Álvaro García Hernández Supervised by Dr./Prof. Antonio Acín and pre-doctoral Luke Mortimer (ICFO) Presented on date 7th July 2022 Registered at Analysis of performance of the Chordal Branch and Bound algorithm ´ Alvaro Garc´ıa Hern´andez ICFO-Institut de Ciencies Fotoniques, The Barcelona Institute of Science and Technology, 08860 Castelldefels (Barcelona), Spain E-mail: [email protected] Abstract. In the era of quantum technology, benchmarking classical algorithms is necessary for certifying the results given by the quantum device to the optimization problem that is wanted to solve. Here we analyse a new algorithm that gives an upper and a lower bound to the ground state solution of Ising type optimization problems. We test its performance in solution planted problems and compare it with simulated annealing, a common algorithm to solve optimization problems, getting in general more reliable results in the same amount of time. Additionally, we verify the tunable hardness of the planting schemes used to generate the optimization problems. Keywords: benchmark, Ising, planting scheme, Chordal Branch and Bound algorithm 1. Introduction Optimization problems based on spin systems are highly used nowadays. The Ising model by itself describes many intriguing physical phenomena, such as frustration and spin glasses. Additionally it can be used in other fields outside of physics, as the solution of optimization problems can be encoded in the ground state of the Ising model. However, the number of possible spin configurations grows exponentially when we add more spins, making it extremely hard to find a general algorithm that solve the problem exactly. Exact algorithms require a computational effort that scales exponentially with size, so the classical approach until now has been the use of heuristic algorithms which give a good quality solution in affordable time and effort. A problem arises with these algorithms, because they only provide upper bounds to the ground state energy. So, when using them as benchmark solutions for quantum optimizers, the only information we get is if the quantum device beats the classical algorithm, but we can’t know if we are close or not to the real ground state energy, the solution to the optimization problem. To solve this problem, in the work by Baccari et. al. [1] a new algorithm was proposed which gives not only an upper bound but also a lower bound. The main ingredient of the algorithm is the SDP relaxation of the original optimization problem, where the problem is relaxed so that the space of feasible solutions is bigger than the real space of spin configurations and then it is solved using SDP (semidefinite programming). Therefore, the solution will minimize the relaxed problem and it is necessarily a lower Analysis of performance of the Chordal Branch and Bound algorithm 2 bound to the original optimization problem. Without any more resources, the algorithm is able to get an upper bound from the lower bound. With this upper and lower bound we already have a confidence region where the ground state energy should be. Applying the branch and bound method, the algorithm is able to reduce the confidence region and increase the precision of the result. In this work, we begin by describing in more detail the algorithm we have just introduced, which from now on we will refer to as the CBB (Chordal Branch and Bound) algorithm. Then, we introduce the two planting schemes used to generate the optimization problems. They are generated using a Python-based software called Chook [2]. These two schemes are perfect for testing our algorithm’s performance and compare it with other optimization methods. In the last part of the thesis we show the results obtained, where we see the correct functioning of the algorithm and the advantages it has over an own-coded simulated annealing algorithm. Moreover, we study the nature of the two planting schemes with results showing the computational complexity the algorithm has when solving different instances. 2. Chordal Branch and Bound algorithm The CBB algorithm is made for solving classical spin systems where the physics are contained in an Ising Hamiltonian that can be written as: H(s) = X 1≤i≤j≤N Jijsisj+ N X i=1 hisi(1) Where s = (s1, ..., sN) is the configuration of an N spin system with si∈ {−1,1}. Jij is the coupling between spins siand sj.hiis a local field the system may experience. The algorithm can be also applied to Hamiltonians with higher order polynomials in the spin variables but we are going to focus only on the Hamiltonian in (1). The goal of the algorithm is to find the ground state energy, a spin configuration such that (1) is minimized. A more useful way to write the Hamiltonian for our purposes would be like (2), where P is a real physical state. H(s) = X 1≤i≤j≤N Jij⟨sisj⟩P+ N X i=1 hi⟨si⟩P(2) This problem is hard to solve when the number of spins increases. Therefore, the idea is to relax the problem. A relaxation is an approximation of a difficult problem by a similar one that it is easier to solve. The solution of the relaxed problem will give us information about the original problem, which in this case will be a lower bound. The idea is called SDP relaxation. The algorithm writes the expectation values needed in (2) in a moment matrix Γ which is by definition positive semidefinite. Γαβ(P) = ⟨xαxβ⟩(3) Where xis a vector of monomials of the spin variables of degree up to 1. Therefore, (3) is said to be in hierarchy level 1. If the variables were of degree up to ν, the moment matrix would be in hierarchy level ν. Analysis of performance of the Chordal Branch and Bound algorithm 3 Γ also obeys some linear constraints which reflect fundamentally that the spin variables take dichotomic values si∈ {−1,1}and commute between them. The Hamiltonian in (2) can be written as tr(hΓ(P)) where his a matrix that depends on the particular Hamiltonian. So the optimization problem can be written as trying to find the minimum of tr(hΓ(P)). The relaxation comes when you write the problem as tr(hΓ), where Γ does not need to come from a real physical state P, but it is any matrix that is positive semidefinite and obeys the linear constraints explained. The space of feasible Γ include all Γ(P) and more matrices, so it is obvious that the result of the minimization is going to be a lower bound. From the moment matrix that minimizes the problem we can obtain without computational effort a good upper bound. The algorithm only needs to align sito the sign obtained in ⟨si⟩of the moment matrix. With this configuration and the Hamiltonian we can get an upper bound. The SDP relaxation is the key ingredient of the algorithm, but there are two important parts more. The first one is called the “chordal extension”. The idea underlying the method is that interactions between spins are normally local, which results in a very sparse graph. Thus, the moment matrix has a lot of unnecessary 2-body correlations. Therefore you can reduce the original moment matrix by a sum of smaller matrices. This reduction makes the relaxation easier to solve, needing less computational resources and improving the scalability of the problem, as it is dominated by the matrix of bigger size. Once the algorithm gets a lower and upper bound you have a confidence region where the ground state energy should be. This is a huge advantage for benchmarking in comparison to heuristics such as simulated annealing, but the CBB algorithm does more. It applies a branch and bound method to improve the confidence region. This method divides the original problem already solved into two branches, one subproblem for si= 1 and the other for si=−1. The two subproblems are relaxed and solved. Keeping track of the upper and lower bounds obtained, the algorithm discards some branches and follows others, making the confidence region smaller until the precision desired. This concludes the explanation of the CBB algorithm. For more details see [1]. One last relevant point is that sometimes, the SDP relaxation using moment matrix in hierarchy level 1 may give bounds very far away so that convergence using branch and bound cannot be fulfilled in reasonable time. In these cases, to reduce the initial gap, the algorithm can be used in a hybrid approach, where small matrices change to hierarchy level 2 while the big matrices, which in fact are the ones which demand the most computational resources, continue in hierarchy level 1. 3. Solution planting schemes In a solution planting scheme one constructs a cost function such that the minimizing configuration is known a priori. Our cost function is the typical Ising-type Hamiltonian Analysis of performance of the Chordal Branch and Bound algorithm 4 in (1). The two planting schemes are chosen because they generate highly tunable and scalable problems that will help to evaluate the CBB algorithm. 3.1. Tile planting In this planting scheme the problem graph is decomposed into edge-disjoint vertexsharing subgraphs. Each subgraph has an Ising problem, so the total cost function is the sum over all the subproblems’ cost functions. All the subproblems are constructed so that the intended solution state is a ground state of the subproblems. Some subproblems may have also other ground states. Therefore, as all the subproblems in the graph have a common ground state, this same state is a ground state of the whole problem. The idea of the planting scheme is as follows: one generates subproblems with a shared ground state that is the state one wants to plant. This makes this same state a ground state for the whole problem and one can get easily the ground state energy, but for the algorithm it is a hard problem to solve. The software Chook generates tile planting problems in square lattices. You can define four subproblem classes Ci(i=1,2,3,4) with different levels of frustration. Chook assigns every subgraph a subproblem Cibased on a probability distribution {pi}, being pithe probability of choosing subproblem Ci. In the article [3] they do an analysis of the nature of this planting scheme, trying to find the hardness of the problem changing the parameters {pi}. When they use a single subproblem class for the whole problem, they saw that the sequence of hardness was C4< C3< C1< C2. It is important to know that the level of frustration is C1< C2< C3< C4. When they mixed two subproblems, they did several experiments. For C1−C3and C1−C4problems they got an easy-hard-easy transition when varying p1, being the peak in p1≈0.35 and p1≈0.45 respectively. For mixing involving C2subproblems, they saw hardness increases continuously with p2. They also did experiments mixing three subproblems with similar results. The conclusion they got is that hard spaces occur when there is a balanced mixture between ferromagnetism and frustration. This is the reason C2is difficult to solve and the mixtures of C1with C3or C4give this easy-hard-easy transitions. 3.2. Wishart planting The Wishart planting scheme generates Ising Hamiltonians of the type: HW P (s) = X i=j Jijsisj=1 2sTJs (4) Where the coupling matrix Jfollows a Wishart distribution. Jis defined by a N x M real-valued matrix W, being N the number of spins and M the tunable parameter which controls the hardness. The Hamiltonian in (4) is minimized if you find a configuration s so that WTs= 0. The goal of the Wishart planting is to construct Wfor the particular planted solution tsuch the condition WTt= 0 is satisfied. Analysis of performance of the Chordal Branch and Bound algorithm 5 These problems can be extremely difficult as in Wishart planting every spin interacts with every other spin such that the matrix has no sparsity. Defining α=M/N, this class of problems exhibit a drastic easy-hard-easy transition as αchanges. 4. Results and discussion In this section we are going to analyse the performance of the CBB algorithm. For that, the algorithm is going to solve different instances of tile planting and Wishart planting problems. For each scheme, first we are going to show some particular examples of the branch and bound reduction of the confidence zone, comparing also the results of applying the algorithm in hierarchy level 1 versus the hybrid scheme of level 1 and 2. We will then do a comparison of performance between the CBB algorithm and simulated annealing. We will measure it contrasting the time needed by both algorithms to try to find the ground state energy. Lastly we will do an analysis of the nature of the planting schemes, trying to find the expected easy-hard-easy transitions. In this last part the algorithm will be in hierarchy level 1 and we will measure hardness as proportional to the number of branch and bound iterations needed to find the ground state. 4.1. Tile planting results The software Chook generates tile planting instances dependent of two parameters. The first one is the size of the square lattice L. After several tries, we decided that the best size for optimizing the time needed and the quality of the results is to choose L= 8, so the number of spins involved is N= 64. Making bigger systems leads to bigger moment matrices which can lead to problems in the amount of time and memory resources needed. The other parameter is the probability distribution of subproblems {pi}. As already said, first we are going to show some examples of how the CBB algorithm performs. In hierarchy level 1 we expect that the algorithm needs some iterations, that progressively close the gap. In the hybrid configuration, we expect less iterations, as the initial gap should be smaller. We show two examples. In the first one (figure 1) we only show the level 1 because the hybrid configuration converges without iterations. This example shows that sometimes, the upper bound finds the ground state energy at first, but we can’t be sure until it converges with the lower bound. In figure 2 we see the second example, a different situation where the upper bound is the one who improves until convergence. Also we see that the hybrid approach needs less iterations and in less time because the biggest matrix continues to be in level 1. Figure 1: Bound convergence for a C1−C4p1= 0.9 instance in hierarchy level 1. Eg=−148. Analysis of performance of the Chordal Branch and Bound algorithm 6 (a) (b) Figure 2: Bound convergence for a C1−C4p1= 0.1 instance with Eg=−76. In (a) the algorithm is in level 1 and it needs 339s. In (b), it is in hybrid configuration and it needs 200s. Now we are going to do a comparison with simulated annealing. For this we are going to take 10 instances of one of the supposedly hardest instances possible, which is the C1−C4p1= 0.4 problem. The results for the CBB algorithm in hierarchy level 1 are in table 1. The numbers in red means the algorithm reached the 2 hours simulating without converging, but the upper bound is already in the ground state energy. Table 1: C1−C4p1= 0.4 problems simulated with CBB algorithm in hierarchy level 1. inst1 inst2 inst3 inst4 inst5 inst6 inst7 inst8 inst9 inst10 BB iteration 0 103 0 103 120 0 103 103 17 96 time 120 s 2 h 190 s 2 h 2 h 190 s 2 h 2 h 37 min 1.9 h Meanwhile a simulated annealing algorithm with the initial temperature Ti= 10, final temperature Tf= 0.01 and steps of distance ∆ = 0.0001 finds the ground state solution 9 times out of 10 in around 200s. Seeing these results one may think the simulated annealing performs better, except in the instances the CBB algorithm does not need any iteration. But in fact the instances where it needs a lot of iterations is normally because the initial gap between bounds is big. In these situations is better to use a hybrid scheme. The new results are in table 2. Table 2: C1−C4p1= 0.4 problems simulated with CBB algorithm in hybrid hierarchy. inst1 inst2 inst3 inst4 inst5 inst6 inst7 inst8 inst9 inst10 BB iteration 0 0 0 0 0 0 1 0 0 0 time 70 s 70 s 70 s 70 s 70 s 70 s 140 s 70 s 70 s 70 s Looking at the results, we can see that in general CBB algorithm performs faster. Also, CBB algorithm tries fewer possibilities in the spin configuration space to find a ground state while simulated annealing, by construction, tries a lot more. Lastly, another advantage is that the CBB algorithm is deterministic, so if it finds the minimum energy, it is always going to do it, while simulated annealing is a probabilistic heuristic. In the last part of the discussion, we will try to find the hardness transitions in the tile planting scheme [3]. Although in some situations the hybrid configuration may give better results, to do this analysis all the problems have to be simulated in the same way, so we are going to use the algorithm in level 1. The first result we are going to Analysis of performance of the Chordal Branch and Bound algorithm 7 check is the single subclass problem sequence of hardness C4< C3< C1< C2. To do it, we are going to simulate 10 instances for each subclass. The results are in table 3. Looking at the average of the iterations needed, we can say that we found the sequence C3< C4< C1< C2, but the iterations needed for C3and C4are quite similar and far from C1and C2, so the sequence C4< C3< C1< C2can be seen in our results. Table 3: Number of branch and bound iterations needed for one subclass problems. class C1C2C3C4 inst1 0 0 0 1 inst2 3 11 0 1 inst3 0 0 1 1 inst4 6 0 0 1 inst5 7 0 2 0 inst6 4 26 2 1 inst7 0 64 0 1 inst8 0 37 0 3 inst9 5 0 0 0 inst10 25 0 0 1 average 5 13,8 0,5 1 The other results are about the mixing of two subclasses. In C1−C4we expect an easy-hard-easy transition with the hardest peak around p1≈0.45. In C1−C3we also predict an easy-hard-easy transition with the hardest peak around p1≈0.35. In C2−C3we foresee a continued increase of hardness while we vary p2towards 1. (a) (b) (c) Figure 3: Plot showing the hardness diagrams for: (a) C1−C4when p1is varied, (b) C1−C3 when p1is varied and (c) C2−C3hardness when p2is varied. Taking a look at figure 3 we can see that for C1−C4and C1−C3there is indeed an easy-hard-easy transition with the peaks where expected. Also, although it is not perfect, in the C2−C3diagram there is an increasing tendency with p2. The main reason we find for some deviation in the results is that the statistical average has been done with 10 data points. Increasing the number of points will lead to better results. So the CBB algorithm has found the ground state energy of every instance, has several advantages over simulated annealing as needing less simulation time and has found correctly the hardness transitions expected in [3]. Therefore we can conclude that it still displays good performance in the tile planting problems. Analysis of performance of the Chordal Branch and Bound algorithm 8 4.2. Wishart planting results The CBB algorithm has one extra problem in the Wishart planting scheme. In this scheme all spins interact between themselves, so we can’t take advantage from the chordal extension in the algorithm, as the problem graph is not sparse. This also makes that we can’t simulate big systems and we can’t use a hybrid approach, the algorithm can only be in hierarchy level 1 or level 2. Chook software generates instances dependent of two parameters, the number of spins Nand α=M/N. The computational hardness is dependent of α. As in tile planting, after doing a brief study of the time and resources needed, we chose to do the analysis for N= 20, N= 12 and N= 8 spins. The first thing we are going to look at is the convergence of the bounds for the hierarchy level 1 and 2, so we need a small spin system. One example is in figure 4. (a) (b) Figure 4: Bound convergence for a N= 20 α= 0.25 instance with Eg=−3.1263044. In (a) the algorithm is in level 1 and it needs 416s. In (b) it is in level 2 and it needs 1647s. Looking at figure 4 there are many important details. In level 1, it needs 169 iterations and 416sto reach the ground state energy while in level 2 it needs 15 iterations and 1647s. This discrepancy is due to the moment matrix. In level 1 the matrix is smaller so, although it needs more iterations, it goes faster. In the other hand, the matrix in level 2 is bigger, it needs more time and memory resources, so although every step is more efficient towards the right solution, it needs more time for each iteration. Now we are going to compare with the simulated annealing algorithm when simulating Wishart problems. As before, we are going to choose one of the most difficult situations for N= 20. The results using the CBB algorithm are shown in table 4. Table 4: N= 20 α= 0.1 problems simulated with CBB algorithm in hierarchy level 1. inst1 inst2 inst3 inst4 inst5 BB iteration 1494 3498 6535 928 1014 time 50 min 2 h 3.6 h 30 min 34 min The cells in table 4 in red now mean that the algorithm did not find the perfect ground state energy. The bounds are close enough so the algorithm stops iterating but the upper bound is not exactly the ground state energy. This may be discouraging but in fact, this is a sign of the tremendous difficulty this scheme has. Also, the number of iterations needed is huge comparing to tile planting. Nevertheless, the algorithm is