51 if (
gates.size() == 0 ) {
56 if (solution_guess.
size() == 0 ) {
67 int iteration_loops_max;
69 if (
config.count(
"max_iteration_loops_bfgs") > 0 ) {
70 config[
"max_iteration_loops_bfgs"].get_property( value );
71 iteration_loops_max = (
int) value;
73 else if (
config.count(
"max_iteration_loops") > 0 ) {
74 config[
"max_iteration_loops"].get_property( value );
75 iteration_loops_max = (
int) value;
82 iteration_loops_max = 1;
87 std::uniform_real_distribution<> distrib_real(0.0, 2*M_PI);
90 long long max_inner_iterations_loc;
91 if (
config.count(
"max_inner_iterations_bfgs") > 0 ) {
92 config[
"max_inner_iterations_bfgs"].get_property( max_inner_iterations_loc );
94 else if (
config.count(
"max_inner_iterations") > 0 ) {
95 config[
"max_inner_iterations"].get_property( max_inner_iterations_loc );
103 int output_periodicity;
104 if (
config.count(
"output_periodicity_cosine") > 0 ) {
106 config[
"output_periodicity_cosine"].get_property( value );
107 output_periodicity = (
int) value;
109 if (
config.count(
"output_periodicity") > 0 ) {
111 config[
"output_periodicity"].get_property( value );
112 output_periodicity = (
int) value;
115 output_periodicity = 0;
121 for (
long long idx=0; idx<iteration_loops_max; idx++) {
131 solution_guess[jdx] = solution_guess[jdx] + distrib_real(
gen)/100;
140 if ( output_periodicity>0 && idx % output_periodicity == 0 ) {
void export_current_cost_fnc(double current_minimum)
Call to print out into a file the current cost function and the second Rényi entropy on the subsyste...
double current_minimum
The current minimum of the optimization problem.
int get_accelerator_num()
Get the number of accelerators to be reserved on DFEs on users demand.
scalar * get_data() const
Call to get the pointer to the stored data.
std::vector< Gate * > gates
The list of stored gates.
A class implementing the BFGS optimizer based on conjugate gradient direction method of M...
double Start_Optimization(Matrix_real &x, long maximal_iterations_in=5001)
Call this method to start the optimization.
std::map< int, int > iteration_loops
A map of <int n: int num> indicating the number of iteration in each step of the decomposition.
void solve_layer_optimization_problem_BFGS(int num_of_parameters, Matrix_real &solution_guess)
Call to solve layer by layer the optimization problem via BBFG algorithm.
int size() const
Call to get the number of the allocated elements.
static void optimization_problem_combined(Matrix_real parameters, void *void_instance, double *f0, Matrix_real &grad)
Call to calculate both the cost function and the its gradient components.
std::map< std::string, Config_Element > config
config metadata utilized during the optimization
Header file for the paralleized calculation of the cost function of the final optimization problem (s...
int qbit_num
number of qubits spanning the matrix of the operation
Header file for DFE support in unitary simulation.
int max_inner_iterations
the maximal number of iterations for which an optimization engine tries to solve the optimization pro...
Matrix_real optimized_parameters_mtx
The optimized parameters for the gates.
Class to store data of complex arrays and its properties.
std::mt19937 gen
Standard mersenne_twister_engine seeded with rd()