XACC
qaoa_circuit.hpp
1 /*******************************************************************************
2  * Copyright (c) 2019 UT-Battelle, LLC.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * and Eclipse Distribution License v1.0 which accompanies this
6  * distribution. The Eclipse Public License is available at
7  * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
8  *License is available at https://eclipse.org/org/documents/edl-v10.php
9  *
10  * Contributors:
11  * Thien Nguyen - initial API and implementation
12  *******************************************************************************/
13 #pragma once
14 
15 #include "Circuit.hpp"
16 #include "IRProvider.hpp"
17 #include "Observable.hpp"
18 #include "xacc_service.hpp"
19 
20 namespace xacc {
21 namespace circuits {
22 // Generate QAOA ansatz for VQE
23 class QAOA : public xacc::quantum::Circuit {
24 public:
25  QAOA() : Circuit("qaoa") {
26  // Default runtime arguments
27  arguments.push_back(std::make_shared<xacc::CompositeArgument>("qReg", "qreg"));
28  }
29 
30  bool expand(const xacc::HeterogeneousMap &runtimeOptions) override;
31  const std::vector<std::string> requiredKeys() override;
32  void applyRuntimeArguments() override;
33  DEFINE_CLONE(QAOA);
34 
35 private:
36  std::shared_ptr<CompositeInstruction> constructParameterizedKernel() const;
37  void parseObservables(Observable* costHam, Observable* refHam);
38 private:
39  size_t m_nbQubits;
40  size_t m_nbSteps;
41  std::vector<std::string> m_refHam;
42  std::vector<std::string> m_costHam;
43 };
44 } // namespace circuits
45 } // namespace xacc
Definition: Circuit.hpp:29
Definition: Accelerator.hpp:25
Definition: heterogeneous.hpp:45
Definition: Observable.hpp:31
Definition: qaoa_circuit.hpp:23