XACC
qaoa.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 "Algorithm.hpp"
16 #include "AlgorithmGradientStrategy.hpp"
17 #include "CompositeInstruction.hpp"
18 
19 namespace xacc {
20 namespace algorithm {
21 class QAOA : public Algorithm
22 {
23 public:
24  bool initialize(const HeterogeneousMap& parameters) override;
25  const std::vector<std::string> requiredParameters() const override;
26  void execute(const std::shared_ptr<AcceleratorBuffer> buffer) const override;
27  std::vector<double> execute(const std::shared_ptr<AcceleratorBuffer> buffer, const std::vector<double> &parameters) override;
28  const std::string name() const override { return "QAOA"; }
29  const std::string description() const override { return ""; }
30  DEFINE_ALGORITHM_CLONE(QAOA)
31 private:
32  Observable* m_costHamObs;
33  Observable* m_refHamObs;
34  Accelerator* m_qpu;
35  Optimizer* m_optimizer;
36  AlgorithmGradientStrategy * gradientStrategy;
37  std::shared_ptr<CompositeInstruction> externalAnsatz;
38  int m_nbSteps;
39 };
40 } // namespace algorithm
41 } // namespace xacc
Definition: Algorithm.hpp:34
Definition: Accelerator.hpp:25
Definition: qaoa.hpp:21
const std::string name() const override
Definition: qaoa.hpp:28
Definition: Accelerator.hpp:44
Definition: heterogeneous.hpp:45
const std::string description() const override
Definition: qaoa.hpp:29
Definition: Optimizer.hpp:48
Definition: Observable.hpp:31
Definition: AlgorithmGradientStrategy.hpp:21