Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiphase Monte Carlo Sampling #147

Merged
merged 89 commits into from
Oct 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
3ef71df
implmentation of exact hmc walk
TolisChal Mar 6, 2021
932e2ae
implementation of boundary oracles for the hpolytope
TolisChal Mar 6, 2021
be84adc
add fake boundary oracles for the other polytope representations
TolisChal Mar 6, 2021
855f2af
implement c++ interface for exponential sampling
TolisChal Mar 6, 2021
462d132
improve boundary oracles and fix bugs
TolisChal Mar 6, 2021
da09805
add root finder for the degree two polynomial
TolisChal Mar 7, 2021
040efa6
complete the root computation and the failure check
TolisChal Mar 7, 2021
127d371
initial implementation of the random walk
TolisChal Mar 7, 2021
279d99c
Merge branch 'hmc_exponential' into exponential_leapfrog
TolisChal Mar 7, 2021
8e36064
improve R documentation and resolve gcc compile error
TolisChal Mar 7, 2021
436a780
improve R documentation
TolisChal Mar 7, 2021
91d0235
Merge branch 'hmc_exponential' into exponential_leapfrog
TolisChal Mar 7, 2021
1ba240e
initial implementation of hmc-leapfrog
TolisChal Mar 7, 2021
89b6fbb
add the new walk to the R interface
TolisChal Mar 8, 2021
ca6db1b
implement the C++ interface for the new walk
TolisChal Mar 8, 2021
cdc6572
fix compile and algorithmic errors
TolisChal Mar 8, 2021
e93270b
improve R documentation
TolisChal Mar 8, 2021
e9e2e08
improve comments and R interface
TolisChal Mar 8, 2021
1ab3362
initial implementation of the Exact HMC for gaussian dist.
TolisChal Mar 8, 2021
b9cf981
add the new walk to C++ and R interfaces
TolisChal Mar 8, 2021
2f01b3d
implement boundary oracle
TolisChal Mar 8, 2021
3140e11
improve boundary oracle for exact hmc for gaussian sampling
TolisChal Mar 8, 2021
3e3345a
remove test R script
TolisChal Mar 8, 2021
983a715
Merge branch 'exponential_leapfrog' into gaussian_exact_hmc
TolisChal Mar 8, 2021
eb9dab8
resolve PR reviews
TolisChal Mar 9, 2021
d1e9acf
fix compile errors
TolisChal Mar 9, 2021
f1e362a
Merge branch 'develop' into hmc_exponential
TolisChal Mar 11, 2021
b982f13
merge develop branch
TolisChal Mar 11, 2021
9c7735a
add burn in methods in exact hmc
TolisChal Mar 11, 2021
0b9f8ad
merge exponential exact hmc and update with burn in methods
TolisChal Mar 11, 2021
51f98e3
implement mmcs's main phase
TolisChal Mar 11, 2021
e62b229
add window ess updater and util test functions
TolisChal Mar 11, 2021
0de37ee
delete white space in new gaussian hmc hpp file
TolisChal Mar 11, 2021
8e649de
Merge branch 'gaussian_exact_hmc' into mmcs
TolisChal Mar 11, 2021
de6b260
compare ess
TolisChal Mar 11, 2021
36e0757
improve ess updater help functions
TolisChal Mar 12, 2021
434de2f
resolve the reviews on the root computation
TolisChal Mar 12, 2021
ed4a92b
resolve review on the header names
TolisChal Mar 12, 2021
3d15a1c
Merge branch 'hmc_exponential' into gaussian_exact_hmc
TolisChal Mar 12, 2021
d1973b3
Merge branch 'gaussian_exact_hmc' into mmcs
TolisChal Mar 12, 2021
7c9389e
improve comments and remove unused files and functions
TolisChal Mar 12, 2021
541e5b9
change a variable name in autocavariance estimator
TolisChal Mar 12, 2021
1ac29c9
improve definition of macro RVOLESTI
TolisChal Mar 13, 2021
de8b3e0
add an example to sample from exponential exact HMC
TolisChal Mar 13, 2021
2a20238
merge exponential_exact_hmc
TolisChal Mar 13, 2021
6d3c481
add a c++ example from the gaussian exact HMC
TolisChal Mar 13, 2021
740d74c
Merge branch 'gaussian_exact_hmc' into mmcs
TolisChal Mar 16, 2021
80a9567
add two c++ examples for mmcs method, boost external files and burn i…
TolisChal Mar 16, 2021
3442f5a
remove RVOLESTI macro
TolisChal Mar 19, 2021
60ed2bd
declare tol variable as static
TolisChal Mar 19, 2021
167b88c
Merge branch 'hmc_exponential' into gaussian_exact_hmc
TolisChal Mar 19, 2021
de95bf4
Merge branch 'gaussian_exact_hmc' into mmcs
TolisChal Mar 19, 2021
dff0c43
fix bug in variable declaration
TolisChal Mar 19, 2021
0b91d9e
Merge branch 'hmc_exponential' into gaussian_exact_hmc
TolisChal Mar 19, 2021
146b4a0
Merge branch 'gaussian_exact_hmc' into mmcs
TolisChal Mar 19, 2021
93d0658
change tolerance variable declaration
TolisChal Mar 19, 2021
df86aa5
Merge branch 'hmc_exponential' into gaussian_exact_hmc
TolisChal Mar 19, 2021
8fb980b
Merge branch 'gaussian_exact_hmc' into mmcs
TolisChal Mar 19, 2021
29dfc59
Merge branch 'develop' into hmc_exponential
TolisChal Mar 21, 2021
a64542c
Merge branch 'hmc_exponential' into gaussian_exact_hmc
TolisChal Mar 21, 2021
d8f358e
Merge branch 'gaussian_exact_hmc' into mmcs
TolisChal Mar 21, 2021
b21203b
remove boost folder
TolisChal Mar 21, 2021
dc1a67d
set upper bound for the number of relfections
TolisChal Mar 23, 2021
4669199
Merge branch 'hmc_exponential' into gaussian_exact_hmc
TolisChal Mar 23, 2021
582acef
set upper bound for the number of relfections
TolisChal Mar 23, 2021
c7079fa
Merge branch 'gaussian_exact_hmc' into mmcs
TolisChal Mar 23, 2021
751f36e
resolve review comments
TolisChal Mar 23, 2021
7bb8617
change the name of TOL to IN_INSIDE_BODY_TOLLERANCE
TolisChal Mar 23, 2021
d7a7495
Merge branch 'hmc_exponential' into gaussian_exact_hmc
TolisChal Mar 23, 2021
7477b64
Merge branch 'gaussian_exact_hmc' into mmcs
TolisChal Mar 23, 2021
eaf8a88
implement parallel mmcs
TolisChal Mar 28, 2021
acb00be
implement billiard walk for threads
TolisChal Mar 28, 2021
4915f46
add example for parallel mmcs and fix compile errors
TolisChal Mar 28, 2021
53c4d53
improve comments and minor code improvements
TolisChal Mar 30, 2021
40bff33
implement door flag for the threads in parallel mmcs
TolisChal Apr 12, 2021
3b12b54
improve parallel mmcs
TolisChal Apr 12, 2021
facbe63
improve burnin in billiard walk
TolisChal Apr 13, 2021
ca1089b
improve the initialization of the length parameter in burnin - BiW
TolisChal Sep 28, 2021
ebd2f0d
improve the initialization of the length parameter in burnin - parall…
TolisChal Sep 28, 2021
980f896
fix a bug in BiW parallel
TolisChal Sep 28, 2021
f5c2d00
update parallel mmcs with openmp tools
TolisChal Sep 29, 2021
0b6a612
merge develop
TolisChal Oct 1, 2021
b63d6db
remove VOLESTIPY macro
TolisChal Oct 1, 2021
0aa906b
resolve PR comments
TolisChal Oct 1, 2021
e98ab8b
fix c++ bugs
TolisChal Oct 1, 2021
dc28129
resolve PR's comments
TolisChal Oct 1, 2021
9d26092
merge gaussian hmc and resolve conflicts
TolisChal Oct 1, 2021
eb86a5c
resolve PR's comments
TolisChal Oct 1, 2021
25ca816
Merge branch 'develop' into mmcs
vissarion Oct 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R-proj/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ importFrom("stats","cov")
importFrom("utils","read.csv")
importFrom(Rcpp,evalCpp)
importFrom(Rcpp,loadModule)
useDynLib(volesti, .registration=TRUE)
useDynLib(volesti, .registration=TRUE)
1 change: 1 addition & 0 deletions R-proj/R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ direct_sampling <- function(body, n, seed = NULL) {
#' Gelman-Rubin and Brooks-Gelman Potential Scale Reduction Factor (PSRF) for each marginal
#'
#' @param samples A matrix that contans column-wise the sampled points from a geometric random walk.
#' @param method A string to reauest diagnostic: (i) \code{'normal'} for psrf of Gelman-Rubin and (ii) \code{'interval'} for psrf of Brooks-Gelman.
#'
#' @references \cite{Gelman, A. and Rubin, D. B.,
#' \dQuote{Inference from iterative simulation using multiple sequences,} \emph{Statistical Science,} 1992.}
Expand Down
1 change: 0 additions & 1 deletion R-proj/src/direct_sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "volume/volume_sequence_of_balls.hpp"
#include "sampling/simplex.hpp"


//' Sample perfect uniformly distributed points from well known convex bodies: (a) the unit simplex, (b) the canonical simplex, (c) the boundary of a hypersphere or (d) the interior of a hypersphere.
//'
//' The \eqn{d}-dimensional unit simplex is the set of points \eqn{\vec{x}\in \R^d}, s.t.: \eqn{\sum_i x_i\leq 1}, \eqn{x_i\geq 0}. The \eqn{d}-dimensional canonical simplex is the set of points \eqn{\vec{x}\in \R^d}, s.t.: \eqn{\sum_i x_i = 1}, \eqn{x_i\geq 0}.
Expand Down
2 changes: 0 additions & 2 deletions R-proj/src/frustum_of_simplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Copyright (c) 2012-2018 Vissarion Fisikopoulos
// Copyright (c) 2018 Apostolos Chalkis


#include <Rcpp.h>
#include <RcppEigen.h>
#include "volume/exact_vols.h"
Expand Down Expand Up @@ -39,5 +38,4 @@ double frustum_of_simplex(Rcpp::NumericVector a, double z0){
std::vector<double> hyp = Rcpp::as<std::vector<double> >(a);

return vol_Ali(hyp, -z0, dim);

}
1 change: 0 additions & 1 deletion R-proj/src/geweke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <boost/random/uniform_real_distribution.hpp>
#include "diagnostics/geweke.hpp"


//' Geweke's MCMC diagnostic
//'
//' @param samples A matrix that contans column-wise the sampled points from a geometric random walk.
Expand Down
3 changes: 0 additions & 3 deletions R-proj/src/inner_ball.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

// Copyright (c) 2012-2018 Vissarion Fisikopoulos
// Copyright (c) 2018 Apostolos Chalkis


#include <Rcpp.h>
#include <RcppEigen.h>
#include <chrono>
Expand Down Expand Up @@ -97,5 +95,4 @@ Rcpp::NumericVector inner_ball(Rcpp::Reference P,

vec[n] = InnerBall.second;
return vec;

}
6 changes: 0 additions & 6 deletions R-proj/src/polytopes_modules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <Rcpp.h>


class Hpolytope {
public:
Hpolytope() {}
Expand Down Expand Up @@ -61,11 +60,9 @@ class VPinterVP {
int type;
};


RCPP_MODULE(polytopes){
using namespace Rcpp ;


//' An exposed class to represent a H-polytope
//'
//' @description A H-polytope is a convex polytope defined by a set of linear inequalities or equivalently a \eqn{d}-dimensional H-polytope with \eqn{m} facets is defined by a \eqn{m\times d} matrix A and a \eqn{m}-dimensional vector b, s.t.: \eqn{Ax\leq b}.
Expand Down Expand Up @@ -100,7 +97,6 @@ RCPP_MODULE(polytopes){
.field( "dimension", &Hpolytope::dimension )
.field( "type", &Hpolytope::type );


//' An exposed C++ class to represent a V-polytope
//'
//' @description A V-polytope is a convex polytope defined by the set of its vertices.
Expand All @@ -126,7 +122,6 @@ RCPP_MODULE(polytopes){
.field( "dimension", &Vpolytope::dimension )
.field( "type", &Vpolytope::type );


//' An exposed C++ class to represent a zonotope
//'
//' @description A zonotope is a convex polytope defined by the Minkowski sum of \eqn{m} \eqn{d}-dimensional segments.
Expand All @@ -152,7 +147,6 @@ RCPP_MODULE(polytopes){
.field( "dimension", &Zonotope::dimension )
.field( "type", &Zonotope::type );


//' An exposed C++ class to represent an intersection of two V-polytopes
//'
//' @description An intersection of two V-polytopes is defined by the intersection of the two coresponding convex hulls.
Expand Down
1 change: 0 additions & 1 deletion R-proj/src/rotating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,4 @@ Rcpp::NumericMatrix rotating (Rcpp::Reference P, Rcpp::Nullable<Rcpp::NumericMat
MT res(TransorfMat.rows(), Rcpp::as<MT>(Mat).rows()+n);
res << Rcpp::as<MT>(Mat).transpose(), TransorfMat;
return Rcpp::wrap(res);

}
1 change: 0 additions & 1 deletion R-proj/src/rounding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,4 @@ Rcpp::List rounding (Rcpp::Reference P,
return Rcpp::List::create(Rcpp::Named("Mat") = Mat, Rcpp::Named("T") = Rcpp::wrap(std::get<0>(round_res)),
Rcpp::Named("shift") = Rcpp::wrap(std::get<1>(round_res)),
Rcpp::Named("round_value") = std::get<2>(round_res));

}
2 changes: 0 additions & 2 deletions R-proj/src/sample_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "ode_solvers/ode_solvers.hpp"
#include "ode_solvers/oracle_functors_rcpp.hpp"


enum random_walks {
ball_walk,
rdhr,
Expand Down Expand Up @@ -714,5 +713,4 @@ Rcpp::NumericMatrix sample_points(Rcpp::Nullable<Rcpp::Reference> P,
}

return Rcpp::wrap(RetMat);

}
1 change: 0 additions & 1 deletion R-proj/src/spectrahedron_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class Spectrahedron {
Spectrahedron(Rcpp::List _matrices) : matrices(_matrices) {}
};


RCPP_MODULE(spectrahedron){
using namespace Rcpp ;

Expand Down
1 change: 0 additions & 1 deletion R-proj/src/volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,4 +405,3 @@ Rcpp::List volume (Rcpp::Reference P,

return Rcpp::List::create(Rcpp::Named("log_volume") = pair_vol.first, Rcpp::Named("volume") = pair_vol.second);
}

1 change: 0 additions & 1 deletion R-proj/src/zonotope_approximation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,4 @@ Rcpp::List zono_approx (Rcpp::Reference Z,
}

return Rcpp::List::create(Rcpp::Named("Mat") = Rcpp::wrap(Mat), Rcpp::Named("fit_ratio") = ratio);

}
5 changes: 3 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# VolEsti (volume computation and sampling library)
# Copyright (c) 2012-2018 Vissarion Fisikopoulos
# Copyright (c) 2018 Apostolos Chalkis
# Copyright (c) 2012-2021 Vissarion Fisikopoulos
# Copyright (c) 2018-2021 Apostolos Chalkis
# Contributed and/or modified by Repouskos Panagiotis, as part of Google Summer of Code 2019 program.
# Licensed under GNU LGPL.3, see LICENCE file

Expand Down Expand Up @@ -112,6 +112,7 @@ else ()
add_subdirectory(logconcave)
#add_subdirectory(spectrahedra)
add_subdirectory(hpolytope-volume)
add_subdirectory(mmcs_method)
add_subdirectory(count-linear-extensions-using-hpolytope)
add_subdirectory(ellipsoid-sampling)
add_subdirectory(order-polytope-basics)
Expand Down
35 changes: 35 additions & 0 deletions examples/mmcs_method/Boost.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function(GetBoost)

find_path(BOOST_DIR NAMES boost PATHS ../external/)

if (NOT BOOST_DIR)

set(BOOST_URL "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2" CACHE STRING "Boost download URL")
set(BOOST_URL_SHA256 "f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41" CACHE STRING "Boost download URL SHA256 checksum")

include(FetchContent)
FetchContent_Declare(
Boost
URL ${BOOST_URL}
URL_HASH SHA256=${BOOST_URL_SHA256}
)
FetchContent_GetProperties(Boost)

if(NOT Boost_POPULATED)
message(STATUS "Fetching Boost")
FetchContent_Populate(Boost)
message(STATUS "Fetching Boost - done")
set(BOOST_DIR ${boost_SOURCE_DIR})
endif()

message(STATUS "Using downloaded Boost library at ${BOOST_DIR}")

else ()
message(STATUS "Boost Library found: ${BOOST_DIR}")

endif()

include_directories(${BOOST_DIR})
include_directories(${BOOST_DIR}/boost)

endfunction()
124 changes: 124 additions & 0 deletions examples/mmcs_method/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# VolEsti (volume computation and sampling library)
# Copyright (c) 2012-2018 Vissarion Fisikopoulos
# Copyright (c) 2018 Apostolos Chalkis
# Contributed and/or modified by Marios Papachristou, as part of Google Summer of Code 2020 program.
# Licensed under GNU LGPL.3, see LICENCE file


project( VolEsti )


CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5)

set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)

if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)


option(DISABLE_NLP_ORACLES "Disable non-linear oracles (used in collocation)" ON)

if(DISABLE_NLP_ORACLES)
add_definitions(-DDISABLE_NLP_ORACLES)
else()
find_library(IFOPT NAMES libifopt_core.so PATHS /usr/local/lib)
find_library(IFOPT_IPOPT NAMES libifopt_ipopt.so PATHS /usr/local/lib)
find_library(GMP NAMES libgmp.so PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu)
find_library(MPSOLVE NAMES libmps.so PATHS /usr/local/lib)
find_library(PTHREAD NAMES libpthread.so PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu)
find_library(FFTW3 NAMES libfftw3.so.3 PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu)

if (NOT IFOPT)

message(FATAL_ERROR "This program requires the ifopt library, and will not be compiled.")

elseif (NOT GMP)

message(FATAL_ERROR "This program requires the gmp library, and will not be compiled.")

elseif (NOT MPSOLVE)

message(FATAL_ERROR "This program requires the mpsolve library, and will not be compiled.")

elseif (NOT FFTW3)

message(FATAL_ERROR "This program requires the fftw3 library, and will not be compiled.")

else()
message(STATUS "Library ifopt found: ${IFOPT}")
message(STATUS "Library gmp found: ${GMP}")
message(STATUS "Library mpsolve found: ${MPSOLVE}")
message(STATUS "Library fftw3 found:" ${FFTW3})

endif(NOT IFOPT)

endif(DISABLE_NLP_ORACLES)

include("Eigen.cmake")
GetEigen()

include("Boost.cmake")
GetBoost()

# Find lpsolve library
find_library(LP_SOLVE NAMES liblpsolve55.so PATHS /usr/lib/lp_solve)

if (NOT LP_SOLVE)
message(FATAL_ERROR "This program requires the lp_solve library, and will not be compiled.")
else ()
message(STATUS "Library lp_solve found: ${LP_SOLVE}")

set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")

include_directories (BEFORE ../../external/Eigen)
include_directories (BEFORE ../../external)
include_directories (BEFORE ../../external/minimum_ellipsoid)
#include_directories (BEFORE ../../include/cartesian_geom)
#include_directories (BEFORE ../../include/convex_bodies)
include_directories (BEFORE ../../external/LPsolve_src/run_headers)
include_directories (BEFORE ../../external/boost)
#include_directories (BEFORE BOOST)
include_directories (BEFORE ../../include/generators)
include_directories (BEFORE ../../include/volume)
include_directories (BEFORE ../../include)
include_directories (BEFORE ../../include/lp_oracles)
include_directories (BEFORE ../../include/nlp_oracles)
include_directories (BEFORE ../../include/convex_bodies)
include_directories (BEFORE ../../include/random_walks)
include_directories (BEFORE ../../include/annealing)
include_directories (BEFORE ../../include/ode_solvers)
include_directories (BEFORE ../../include/root_finders)
include_directories (BEFORE ../../include/samplers)
include_directories (BEFORE ../../include/misc)
include_directories (BEFORE ../../include/optimization)

# for Eigen
if (${CMAKE_VERSION} VERSION_LESS "3.12.0")
add_compile_options(-D "EIGEN_NO_DEBUG")
else ()
add_compile_definitions("EIGEN_NO_DEBUG")
endif ()


add_definitions(${CMAKE_CXX_FLAGS} "-std=c++11") # enable C++11 standard
add_definitions(${CMAKE_CXX_FLAGS} "-O3") # optimization of the compiler
#add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lgsl")
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lm")
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-ldl")
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-DBOOST_NO_AUTO_PTR")
#add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lgslcblas")
#add_definitions( "-O3 -lgsl -lm -ldl -lgslcblas" )

find_package(OpenMP REQUIRED)

add_executable (skinny_cube_10_dim skinny_cube_10_dim.cpp)
add_executable (random_hpoly_50_dim random_hpoly_50_dim.cpp)
add_executable (random_hpoly_50_dim_parallel random_hpoly_50_dim_parallel.cpp)

TARGET_LINK_LIBRARIES(skinny_cube_10_dim ${LP_SOLVE})
TARGET_LINK_LIBRARIES(random_hpoly_50_dim ${LP_SOLVE})
TARGET_LINK_LIBRARIES(random_hpoly_50_dim_parallel ${LP_SOLVE} OpenMP::OpenMP_CXX)


endif()
30 changes: 30 additions & 0 deletions examples/mmcs_method/Eigen.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function(GetEigen)
find_path(EIGEN_DIR NAMES Eigen PATHS ../../external)

if (NOT EIGEN_DIR)
include(FetchContent)
FetchContent_Declare(
eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG 3.3.9
)

FetchContent_GetProperties(eigen)

if(NOT eigen_POPULATED)
message(STATUS "Eigen library not found locally, downloading it.")
FetchContent_Populate(eigen)
endif()

set(EIGEN_DIR ${eigen_SOURCE_DIR})
message(STATUS "Using downloaded Eigen library at: ${EIGEN_DIR}")

else ()

message(STATUS "Eigen Library found: ${EIGEN_DIR}")

endif()

include_directories(${EIGEN_DIR})

endfunction()
Loading