@@ -89,31 +89,3 @@ def aClcostFct(state, G):
89
89
#assert set(intlist) in the_itt
90
90
#assert aClcostFct(name, giraf) <= -1
91
91
92
- # test for full solution...
93
- truth_list = []
94
- for index in range (10 ):
95
-
96
- integ = np .random .randint (1 ,7 )
97
- #create random graph with either all nodes connected, or no nodes connected
98
- integ2 = np .random .randint (0 ,1 )
99
-
100
- secondGraph = nx .erdos_renyi_graph (integ ,integ2 )
101
- secondQarg = QuantumVariable (secondGraph .number_of_nodes ())
102
- secondInstance = QAOAProblem (cost_operator = maxCliqueCostOp (secondGraph ), mixer = RX_mixer , cl_cost_function = maxCliqueCostfct (secondGraph ))
103
- secondInstance .set_init_function (init_function = init_state )
104
- theNiceQAOA2 = secondInstance .run (qarg = secondQarg , depth = 3 , max_iter = 50 , mes_kwargs = {"shots" : 100000 })
105
- maxOne = sorted (theNiceQAOA2 , key = theNiceQAOA2 .get , reverse = True )[:1 ]
106
- #if no nodes connected, maxClique sol should just be the first node, i.e. "1000" (more or less zeros)
107
- if integ2 == 0 :
108
- string = "1"
109
- string += str (integ2 ) * (secondGraph .number_of_nodes ()- 1 )
110
- testStr = [string ]
111
- #if all nodes connected, maxClique sol should be all nodes, i.e. "1111" (more or less ones)
112
- if integ2 == 1 :
113
- testStr = [str (integ2 ) * secondGraph .number_of_nodes ()]
114
-
115
-
116
- if testStr == maxOne :
117
- truth_list .append (1 )
118
-
119
- assert sum (truth_list )/ 10 > 0.5
0 commit comments