Class VqeOpt

Inheritance Relationships

Derived Types

Class Documentation

class VqeOpt

Selection of classical optimisation algorithms and associated hyperparameters. Override get() in a derived class and provide a definition that validates the relevant hyperparameters there.

Additional hyperparameters ie “extra options” should be stored in the YAML::Node member [m_node_]

Subclassed by qb::vqee::AdamMLP, qb::vqee::CmaesMLP, qb::vqee::LbfgsMLP, qb::vqee::NLO

Public Functions

inline VqeOpt()

Default constructor.

inline VqeOpt(const std::string &in_provider, const std::string &in_algorithm)

Constructor for the most common use case.

inline VqeOpt(const std::string &in_provider, const std::string &in_algorithm, const std::vector<double> &in_initial_parameters, const int in_maxeval, const double in_ftol, const YAML::Node &in_node)

Constructor for initialisation of all data members.

inline virtual std::shared_ptr<xacc::Optimizer> get()

Getters.

Public Static Functions

template<typename T>
static inline void pass_yaml_to_xacc(const YAML::Node &node, const std::set<std::string> &keys, const std::map<std::string, std::string> &yaml_to_xacc_keys, xacc::HeterogeneousMap &in_xoptions, bool debug = false)

Helper template for converting YAML to XACC options

Parameters:
  • node – YAML formatted string of extra options

  • keys – std::set of key names expected in the YAML that all have a corresponding value of type T

  • yaml_to_xacc_keys – Lookup from keys in YAML to keys recognised by XACC

  • in_xoptions – Resulting XACC options

  • debug – Debug flag

Protected Attributes

std::string m_provider_

Name for the C++ optimisation library. These libraries supply a collection of algorithms through a consistent interface.

std::string m_algorithm_

Name for an algorithm that performs optimisation.

std::vector<double> m_initial_parameters_

Initial values for theta (the parameters that will be varied to find the optimum)

int m_maxeval_

Max number of iterations.

double m_ftol_

Function tolerance.

YAML::Node m_node_

Extra options to supply as configuration information to the optimiser.