Update app.py
Browse files
app.py
CHANGED
@@ -134,7 +134,7 @@ problem.minimize(
|
|
134 |
)
|
135 |
|
136 |
# Print to confirm the problem is not empty
|
137 |
-
print("
|
138 |
print(problem.export_as_lp_string())
|
139 |
|
140 |
# 2) Set up QAOA solver on the qasm_simulator
|
@@ -147,9 +147,7 @@ quantum_instance = QuantumInstance(
|
|
147 |
)
|
148 |
|
149 |
qaoa = QAOA(
|
150 |
-
optimizer=SPSA(maxiter=50),
|
151 |
-
reps=2, # number of QAOA layers
|
152 |
-
quantum_instance=quantum_instance
|
153 |
)
|
154 |
|
155 |
solver = MinimumEigenOptimizer(qaoa)
|
@@ -157,7 +155,7 @@ solver = MinimumEigenOptimizer(qaoa)
|
|
157 |
# 3) Solve the QUBO
|
158 |
result = solver.solve(problem)
|
159 |
|
160 |
-
print("
|
161 |
print("Optimal solution:", result.x)
|
162 |
print("Objective value:", result.fval)
|
163 |
|
|
|
134 |
)
|
135 |
|
136 |
# Print to confirm the problem is not empty
|
137 |
+
print("--- Quadratic Program ---")
|
138 |
print(problem.export_as_lp_string())
|
139 |
|
140 |
# 2) Set up QAOA solver on the qasm_simulator
|
|
|
147 |
)
|
148 |
|
149 |
qaoa = QAOA(
|
150 |
+
optimizer=SPSA(maxiter=50), reps=2, quantum_instance=quantum_instance
|
|
|
|
|
151 |
)
|
152 |
|
153 |
solver = MinimumEigenOptimizer(qaoa)
|
|
|
155 |
# 3) Solve the QUBO
|
156 |
result = solver.solve(problem)
|
157 |
|
158 |
+
print("--- QAOA Results ---")
|
159 |
print("Optimal solution:", result.x)
|
160 |
print("Objective value:", result.fval)
|
161 |
|