openjij
Framework for the Ising model and QUBO.
Loading...
Searching...
No Matches
openjij::graph::BinaryPolynomialModel< FloatType > Class Template Reference

#include <binary_polynomial_model.hpp>

Public Types

using ValueType = FloatType
 The value type.
 
using IndexType = utility::IndexType
 The index type.
 
using IndexHash = utility::IndexHash
 The hash for IndexType.
 
using VariableType = std::int8_t
 The variable type, which here represents binary variables \( x_i\in \{0, 1\} \).
 

Public Member Functions

 BinaryPolynomialModel (const std::vector< std::vector< IndexType > > &key_list, const std::vector< ValueType > &value_list)
 
std::int32_t GetDegree () const
 Get the degree of the polynomial interactions.
 
std::int32_t GetSystemSize () const
 Get the system size.
 
const std::vector< IndexType > & GetIndexList () const
 Get the index list of the polynomial interactions.
 
const std::unordered_map< IndexType, std::int32_t, IndexHash > & GetIndexMap () const
 Get the mapping from the index to the integer.
 
const std::vector< std::pair< std::vector< std::int32_t >, ValueType > > & GetKeyValueList () const
 Get the integer key and value list as pair.
 
const std::vector< std::vector< std::size_t > > & GetAdjacencyList () const
 Get the adjacency list, which stored the integer index of the polynomial interaction specified by the site index.
 
ValueType GetEstimatedMinEnergyDifference () const
 Get estimated minimum energy difference.
 
ValueType GetEstimatedMaxEnergyDifference () const
 Get estimated maximum energy difference.
 
ValueType CalculateEnergy (const std::vector< VariableType > &variables) const
 Calculate energy corresponding to the variable configuration.
 

Private Attributes

std::int32_t degree_ = 0
 The degree of the interactions.
 
std::int32_t system_size_ = 0
 The system size.
 
std::vector< IndexTypeindex_list_
 The index list of the interactions.
 
std::unordered_map< IndexType, std::int32_t, IndexHashindex_map_
 The mapping from the index to the integer.
 
std::vector< std::pair< std::vector< std::int32_t >, ValueType > > key_value_list_
 The integer key and value list as pair.
 
std::vector< std::vector< std::size_t > > adjacency_list_
 The adjacency list, which stored the integer index of the polynomial interaction specified by the site index.
 
ValueType estimated_min_energy_difference_ = 0
 The estimated minimum energy difference.
 
ValueType estimated_max_energy_difference_ = 0
 The estimated maximum energy difference.
 
const ValueType min_max_energy_difference_ratio_ = 1e-08
 The ratio of minimum and maximum energy difference set by 1e-08.
 

Member Typedef Documentation

◆ IndexHash

The hash for IndexType.

◆ IndexType

◆ ValueType

◆ VariableType

template<typename FloatType >
using openjij::graph::BinaryPolynomialModel< FloatType >::VariableType = std::int8_t

The variable type, which here represents binary variables \( x_i\in \{0, 1\} \).

Constructor & Destructor Documentation

◆ BinaryPolynomialModel()

Member Function Documentation

◆ CalculateEnergy()

template<typename FloatType >
ValueType openjij::graph::BinaryPolynomialModel< FloatType >::CalculateEnergy ( const std::vector< VariableType > &  variables) const
inline

Calculate energy corresponding to the variable configuration.

Parameters
variablesThe variable configuration.
Returns
The energy.

References openjij::graph::BinaryPolynomialModel< FloatType >::key_value_list_, and openjij::graph::BinaryPolynomialModel< FloatType >::system_size_.

◆ GetAdjacencyList()

template<typename FloatType >
const std::vector< std::vector< std::size_t > > & openjij::graph::BinaryPolynomialModel< FloatType >::GetAdjacencyList ( ) const
inline

Get the adjacency list, which stored the integer index of the polynomial interaction specified by the site index.

Returns
The adjacency list.

References openjij::graph::BinaryPolynomialModel< FloatType >::adjacency_list_.

◆ GetDegree()

template<typename FloatType >
std::int32_t openjij::graph::BinaryPolynomialModel< FloatType >::GetDegree ( ) const
inline

Get the degree of the polynomial interactions.

Returns
The degree.

References openjij::graph::BinaryPolynomialModel< FloatType >::degree_.

◆ GetEstimatedMaxEnergyDifference()

template<typename FloatType >
ValueType openjij::graph::BinaryPolynomialModel< FloatType >::GetEstimatedMaxEnergyDifference ( ) const
inline

Get estimated maximum energy difference.

Returns
The estimated maximum energy difference.

References openjij::graph::BinaryPolynomialModel< FloatType >::estimated_max_energy_difference_.

◆ GetEstimatedMinEnergyDifference()

template<typename FloatType >
ValueType openjij::graph::BinaryPolynomialModel< FloatType >::GetEstimatedMinEnergyDifference ( ) const
inline

Get estimated minimum energy difference.

Returns
The estimated minimum energy difference.

References openjij::graph::BinaryPolynomialModel< FloatType >::estimated_min_energy_difference_.

◆ GetIndexList()

template<typename FloatType >
const std::vector< IndexType > & openjij::graph::BinaryPolynomialModel< FloatType >::GetIndexList ( ) const
inline

Get the index list of the polynomial interactions.

Returns
The index list.

References openjij::graph::BinaryPolynomialModel< FloatType >::index_list_.

◆ GetIndexMap()

template<typename FloatType >
const std::unordered_map< IndexType, std::int32_t, IndexHash > & openjij::graph::BinaryPolynomialModel< FloatType >::GetIndexMap ( ) const
inline

Get the mapping from the index to the integer.

Returns
The index map.

References openjij::graph::BinaryPolynomialModel< FloatType >::index_map_.

◆ GetKeyValueList()

template<typename FloatType >
const std::vector< std::pair< std::vector< std::int32_t >, ValueType > > & openjij::graph::BinaryPolynomialModel< FloatType >::GetKeyValueList ( ) const
inline

Get the integer key and value list as pair.

Returns
The integer key and value list as pair.

References openjij::graph::BinaryPolynomialModel< FloatType >::key_value_list_.

◆ GetSystemSize()

template<typename FloatType >
std::int32_t openjij::graph::BinaryPolynomialModel< FloatType >::GetSystemSize ( ) const
inline

Get the system size.

Returns
The system size.

References openjij::graph::BinaryPolynomialModel< FloatType >::index_list_.

Member Data Documentation

◆ adjacency_list_

template<typename FloatType >
std::vector<std::vector<std::size_t> > openjij::graph::BinaryPolynomialModel< FloatType >::adjacency_list_
private

The adjacency list, which stored the integer index of the polynomial interaction specified by the site index.

Referenced by openjij::graph::BinaryPolynomialModel< FloatType >::BinaryPolynomialModel(), and openjij::graph::BinaryPolynomialModel< FloatType >::GetAdjacencyList().

◆ degree_

◆ estimated_max_energy_difference_

◆ estimated_min_energy_difference_

◆ index_list_

◆ index_map_

◆ key_value_list_

◆ min_max_energy_difference_ratio_

template<typename FloatType >
const ValueType openjij::graph::BinaryPolynomialModel< FloatType >::min_max_energy_difference_ratio_ = 1e-08
private

The ratio of minimum and maximum energy difference set by 1e-08.

\[ {\rm ratio} = \frac{\Delat E_{{\rm min}}}{\Delat E_{{\rm max}}}\]

Referenced by openjij::graph::BinaryPolynomialModel< FloatType >::BinaryPolynomialModel().

◆ system_size_


The documentation for this class was generated from the following file: