![]() Quantum Approximate Optimization Algorithm Yield a tuple with the two paired cars followed by theįor car0, car1 in zip(car_sequence, car_sequence): Otheriwse, assign an antiferromagnetic(-1) The first/second in their respective pairs. ![]() """Assign interactions between adjacent cars.Īssign a ferromagnetic(1) interaction if both elements of the pair are ![]() def spin_glass(car_sequence: Sequence) -> Sequence]: All color changes in the car sequence are equivalent which is why we have equal magnitude ferromagnetic and antiferromagnetic interactions and additionally we choose unit magnitude interactions. If two cars are next to each other and one of the cars is the first and the other the second in their respective car pairs we have to add a antiferromagnetic interaction to the spin glass in order to penalize the color change because in this case the color for the car that is the second car in its car pair is exactly the opposite. ![]() The interactions of the spin glass can be deduced proceeding through the fixed car sequence: If two cars are adjacent to each other and both of them are either the first or the second car in their respective car pairs we can add a ferromagnetic interaction to the spin glass in order to penalize the color change between these two cars. Every second car is painted with the repsective other color. The state of every spin represents the color we paint the respective first car in the seqence of every car pair. the spin glass has as many spins as the sequence has car pairs. Interestingly, that is possible with no spatial overhead, i.e. To be able to solve the binary paintshop problem with the Quantum Approximate Optimization Algorithm (QAOA) we need to translate the problem to a spin glass problem. ![]() Beating classical heuristics for the binary paint shop problem with the quantum approximate optimization algorithm). The quantum algorithm presented here can deliver, on average, better solutions than all polynomial runtime heuristics specifically developed for the paintshop problem in constant time (constant query complexity) (c.f. Quantum Computing in the NISQ era and beyond). This is the situation where substantial quantum speedup can be assumed (c.f. A performance guarantee in this context would be a proof that an approximation algorithm never gives us a solution with a number of color changes that is more than some factor times the optimal number of color changes. It is NP-hard to solve the binary paintshop problem exactly as well as approximately with an arbitrary performance guarantee. Obvious generalizations exist, for example more than two colors and groups of cars with more than 2 cars where it is permissible to exchange colors, however for demonstration purposes it suffices to consider the here presented binary version of the paintshop problem. When we have chosen the color for the first car the other car has to be painted in the other respective color. However, a rearrangement of the car sequence is not at our disposal (because of restrictions that are posed by the remainig manufacturing processes), but we can decide once we reach the first car of each car pair which color to paint the pair first. This color change procedure costs time, paint, water and ultimately costs money, which is why we want to minimize the number of color changes. If two consecutive cars in the sequence are painted in different colors the robots have to rinse the old color, clean the nozzles and flush in the new color. # count the number of times two adjacent cars differ in colorįor color0, color1 in zip(color_sequence, color_sequence): # paint the noted color for the first car in the pairĬolor_sequence.append(paint_bitstring) # paint the other color for the second car in the pairĬolor_sequence.append(not paint_bitstring) For example, 0 for blueĬar_sequence: A sequence that determines which cars areĬount of the number of times the robots change the color Paint_bitstring: A sequence that determines the color to Which notes the color for the first car in each pair. Paint each car in car_sequence according to paint_bitstring, """Count the number of times the color changes if the robots def color_changes(paint_bitstring: Sequence, car_sequence: Sequence) -> int: The objective of the following minimization procedure is to minimize the number of color changes in the paintshop. The task is to paint the cars such that in the end for every pair of cars one is painted in red and the other in blue. CAR_PAIR_COUNT = 10Ĭar_sequence = np.random.permutation( * 2) Each car has a identical partner that only differs in the color it has to be painted. Assume an automotive paint shop and a random, but fixed sequence of 2*n cars. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |