Skip to content

Commit 7d72d55

Browse files
committed
removed indeterministic part of maxclique test
1 parent a84dc6a commit 7d72d55

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

tests/test_QAOAmaxClique.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,3 @@ def aClcostFct(state, G):
8989
#assert set(intlist) in the_itt
9090
#assert aClcostFct(name, giraf) <= -1
9191

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

Comments
 (0)