v2DM-DOCI  1.0
SimulatedAnnealing.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Copyright (C) 2014-2015 Ward Poelmans
5  *
6  * This file is part of v2DM-DOCI.
7  *
8  * v2DM-DOCI is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * Foobar is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
20  *
21  * @END LICENSE
22  */
23 
24 #ifndef SIM_ANNEAL_H
25 #define SIM_ANNEAL_H
26 
27 #include <random>
28 
29 #include "Method.h"
30 #include "Hamiltonian.h"
31 #include "UnitaryMatrix.h"
32 #include "OrbitalTransform.h"
33 
34 namespace doci2DM {
35 class PotentialReduction;
36 class BoundaryPoint;
37 }
38 
39 namespace simanneal
40 {
41 
43 {
44  public:
46 
48 
49  virtual ~SimulatedAnnealing();
50 
51  bool accept_function(double);
52 
53  void optimize();
54 
55  void optimize_mpi();
56 
57  double calc_new_energy();
58 
59  void calc_energy();
60 
61  double get_energy() const;
62 
63  void Set_max_angle(double);
64 
65  void Set_delta_angle(double);
66 
67  void Set_start_temp(double);
68 
69  void Set_delta_temp(double);
70 
72 
74 
76 
77  doci2DM::Method& getMethod() const;
78 
79  void UseBoundaryPoint();
80 
81  void UsePotentialReduction();
82 
84 
86 
87  private:
88 
89  std::unique_ptr<doci2DM::Method> method;
90 
92  std::unique_ptr<CheMPS2::Hamiltonian> ham;
93 
95  std::unique_ptr<simanneal::OrbitalTransform> orbtrans;
96 
98  std::unique_ptr<simanneal::UnitaryMatrix> opt_unitary;
99 
101  double energy;
103  double start_temp;
105  double delta_temp;
107  double delta_angle;
109  double max_angle;
111  unsigned int steps;
113  unsigned int max_steps;
114 
116  double cur_temp;
117 
119  unsigned int unaccepted;
120 
123 
125  std::random_device rd;
127  std::mt19937_64 mt;
128 };
129 
130 }
131 
132 #endif /* SIM_ANNEAL_H */
133 
134 /* vim: set ts=3 sw=3 expandtab :*/
double cur_temp
current temperature
doci2DM::Method & getMethod() const
double delta_temp
the change in temperatur between steps
unsigned int steps
the number of steps done
double delta_angle
the change in the angle allows in steps
OrbitalTransform & getOrbitalTf() const
double start_temp
the start temperatur
std::unique_ptr< simanneal::OrbitalTransform > orbtrans
the actual orbital transform
SimulatedAnnealing(const CheMPS2::Hamiltonian &)
unsigned int unaccepted
number of unaccepted steps
std::random_device rd
the real random input (hopefully)
std::unique_ptr< simanneal::UnitaryMatrix > opt_unitary
the current unitary
double max_angle
the maximum allows angle
doci2DM::BoundaryPoint & getMethod_BP() const
bool stop_running
bool to indicate if we should quite the optimalisation
unsigned int max_steps
max number of steps
simanneal::UnitaryMatrix & get_Optimal_Unitary()
std::mt19937_64 mt
our pseudo-random generator
doci2DM::PotentialReduction & getMethod_PR() const
std::unique_ptr< doci2DM::Method > method
double energy
energy of current iteration
std::unique_ptr< CheMPS2::Hamiltonian > ham
Holds the current hamiltonian.
CheMPS2::Hamiltonian & getHam() const