Skip to content

Commit

Permalink
CRHMC Volume Cooling Gaussians
Browse files Browse the repository at this point in the history
  • Loading branch information
vgnecula committed Jul 1, 2024
1 parent 9114f37 commit 2a2ec8e
Show file tree
Hide file tree
Showing 3 changed files with 658 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/crhmc_sampling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,7 @@ else ()
TARGET_LINK_LIBRARIES(sampling_functions QD_LIB ${MKL_LINK} ${LP_SOLVE})
add_executable (simple_crhmc simple_crhmc.cpp)
TARGET_LINK_LIBRARIES(simple_crhmc QD_LIB ${MKL_LINK} ${LP_SOLVE})
add_executable(volume_example volume_example.cpp)
target_link_libraries(volume_example QD_LIB ${MKL_LINK} ${LP_SOLVE})

endif()
40 changes: 40 additions & 0 deletions examples/crhmc_sampling/volume_example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "Eigen/Eigen"
#include <vector>
#include "cartesian_geom/cartesian_kernel.h"
#include "convex_bodies/hpolytope.h"
#include "generators/known_polytope_generators.h"

#include "random_walks/random_walks.hpp"
#include "volume/volume_sequence_of_balls.hpp"
#include "volume/volume_cooling_gaussians_crhmc.hpp"
#include "volume/volume_cooling_balls.hpp"

#include <iostream>
#include <fstream>
#include "misc/misc.h"

typedef double NT;
typedef Cartesian<NT> Kernel;
typedef typename Kernel::Point Point;
typedef BoostRandomNumberGenerator<boost::mt19937, NT, 3> RNGType;
typedef HPolytope<Point> HPOLYTOPE;

template <int simdLen>
void calculateAndVerifyVolume(HPOLYTOPE& polytope) {
int walk_len = 100;
NT e = 0.1;

NT volume = volume_cooling_gaussians<CRHMCWalk, RNGType, HPOLYTOPE, 4>(polytope, e, walk_len);

std::cout << "Volume " << volume << std::endl;
}

int main() {

HPOLYTOPE HP = generate_simplex<HPOLYTOPE>(2,false);
std::cout << "HPoly: " << std::endl;
HP.print();
calculateAndVerifyVolume<4>(HP);

return 0;
}
Loading

0 comments on commit 2a2ec8e

Please sign in to comment.