From 9114f37b4a3cc3838a9bbdc64118d136be080d70 Mon Sep 17 00:00:00 2001 From: vfisikop Date: Fri, 15 Mar 2024 15:00:10 +0200 Subject: [PATCH] Update and simplify documentation --- docs/getting_started/cpp_example.md | 47 +++++++---------------------- docs/getting_started/install.md | 45 ++------------------------- docs/getting_started/r_example.md | 7 ----- docs/index.rst | 1 - docs/misc/documentation.md | 20 ------------ 5 files changed, 14 insertions(+), 106 deletions(-) delete mode 100644 docs/getting_started/r_example.md delete mode 100644 docs/misc/documentation.md diff --git a/docs/getting_started/cpp_example.md b/docs/getting_started/cpp_example.md index 82ac82902..e3e39dcbf 100644 --- a/docs/getting_started/cpp_example.md +++ b/docs/getting_started/cpp_example.md @@ -5,7 +5,6 @@ Here we give step-by-step instructions for how to estimate the volume of a 3-dim Write the following C++ code and save it in `volume_example.cpp` ```c++ - #include "Eigen/Eigen" #include "cartesian_geom/cartesian_kernel.h" #include "convex_bodies/hpolytope.h" @@ -30,8 +29,7 @@ int main() { double e = 0.1; // Calculating volume of the passed polytope - double volume = volume_cooling_balls - (HP, e, walk_len).second; + double volume = volume_cooling_balls(HP, e, walk_len).second; std::cout << "Volume of the cube: " << volume << std::endl; @@ -46,18 +44,15 @@ project( VolEsti-cpp-example ) CMAKE_MINIMUM_REQUIRED(VERSION 3.11) -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) - -if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -endif(COMMAND cmake_policy) - add_definitions(-DDISABLE_NLP_ORACLES) -option(BUILTIN_EIGEN "Use eigen from ../../external" OFF) - include("../../external/cmake-files/Eigen.cmake") GetEigen() +if (${CMAKE_VERSION} VERSION_LESS "3.12.0") + add_compile_options(-D "EIGEN_NO_DEBUG") +else () + add_compile_definitions("EIGEN_NO_DEBUG") +endif () include("../../external/cmake-files/Boost.cmake") GetBoost() @@ -65,33 +60,13 @@ GetBoost() include("../../external/cmake-files/LPSolve.cmake") GetLPSolve() -# 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) - include_directories (BEFORE ../../include) - - # 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 +set(CMAKE_EXPORT_COMPILE_COMMANDS "ON") - add_executable (volume_example volume_example.cpp) - TARGET_LINK_LIBRARIES(volume_example ${LP_SOLVE}) +include_directories (BEFORE ../../external) +include_directories (BEFORE ../../include) -endif() +add_executable (volume_example volume_example.cpp) +target_link_libraries(volume_example PUBLIC lp_solve) ``` We will use `cmake` to build the makefile and compile our example. diff --git a/docs/getting_started/install.md b/docs/getting_started/install.md index cfdb773e7..58fcfe163 100644 --- a/docs/getting_started/install.md +++ b/docs/getting_started/install.md @@ -6,16 +6,13 @@ Installation Guide ### Compile C++ sources and run tests --- -To compile the C++ code you need the [lp_solve](http://lpsolve.sourceforge.net/5.5/) library. For example, for Unix/Linux you need `liblpsolve55.so`. This is available from the library's [webpage](http://lpsolve.sourceforge.net/5.5/) as well as a package in several linux distributions e.g. [debian](https://packages.debian.org/stretch/liblpsolve55-dev) `sudo apt-get install lp-solve`. - -You have to specify the path to `liblpsolve55.so/dll/dylib`, by running, in folder test: +To compile the tests of the C++ interface simply ```bash mkdir -p test/build && cd test/build -cmake -DLP_SOLVE=_PATH_TO_LIB_FILE_ .. +cmake .. make ``` -For example: `-DLP_SOLVE=/usr/lib/lpsolve/liblpsolve55.so` In WSL (Windows Subsystem Linux), you can run the following command to install libc6-dev-i386. This will be required for `ieeefp.h` which is used by `qd` library, @@ -59,43 +56,7 @@ docker run -it -v $PWD:/volesti -w /volesti --name=volesti-dev volesti:dev /bin/ ## R Interface -### Install Rcpp package ---- - -1. Install package-dependencies: ``Rcpp``, ``RcppEigen``, ``BH``. - -2. Then use ``devtools`` package to install ``volesti`` Rcpp package. From terminal go to folder ``/root/R-proj`` and run in terminal: - -```bash - Rscript -e 'Rcpp::compileAttributes()' - R CMD INSTALL --no-multiarch --with-keep.source . -``` - -3. You can use Rstudio as well to open ``volesti.Rproj`` and then click `build source Package` and then `Install and Restart` in `Build` at the menu bar. - -### Generate CRAN version ---- - -To generate the CRAN version of the R package follow the instructions below: - -1. From the command line navigate to folder ``/cran_gen``. Then Run: - -```r - source('genCRANpkg.R') -``` - -2. Open ``genCRANpkg.R`` script with `Rstudio` and run it. - -### Run volesti from R ---- - -* The main function is ``volume()``. It can be used to approximate the volume of a convex polytope given as a set of linear inequalities or a set of vertices (d-dimensional points) or as a Minkowski sum of segments (zonotope). There are three algorithms that can be used (``SequenceOfBalls``, ``CoolingGaussian`` and ``CoolingBalls``). -* The function ``sample_points()`` can be used to sample points from a convex polytope with uniform or spherical gaussian target distribution. -* The function ``round_polytope()`` can be used to round a convex polytope. -* The function ``rand_rotate()`` can be used to apply a random rotation to a convex polytope. - -For more details you can read the documentation in folder ``/inst/doc``. - +An ``R`` interface is available from the package [Rvolesti](https://github.com/GeomScale/Rvolesti). ## Python Interface diff --git a/docs/getting_started/r_example.md b/docs/getting_started/r_example.md deleted file mode 100644 index 0850de823..000000000 --- a/docs/getting_started/r_example.md +++ /dev/null @@ -1,7 +0,0 @@ -# How to create your first example using the R interface - -Here we give step-by-step instructions for how to estimate the volume of a 3-dimensional cube using the R interface of the `volesti` library. - -The user first should install the R interface by following instructions in {doc}`installation guide `. - -to be written ... diff --git a/docs/index.rst b/docs/index.rst index a64b5bf4b..ce0b73886 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,7 +12,6 @@ Welcome to VolEsti's documentation! getting_started/install.md getting_started/cpp_example.md - getting_started/r_example.md .. toctree:: :caption: Tutorials diff --git a/docs/misc/documentation.md b/docs/misc/documentation.md deleted file mode 100644 index 35e066604..000000000 --- a/docs/misc/documentation.md +++ /dev/null @@ -1,20 +0,0 @@ -# Generate documentation - -## How to generate documentation - -Technologies used: Doxygen + Spnynx + Breathe - -to be written ... - -## Create pdf documentation from Rd files - -* Install volesti library. -* In `R` mode (or in Rstudio) Run -```r -pack = "volesti" -path = find.package(pack) -system(paste(shQuote(file.path(R.home("bin"), "R")), - "CMD", "Rd2pdf", shQuote(path))) -``` -* The pdf will be created and saved in `R-proj` folder. -* We give such a documentation in `/R-proj/doc` folder.