Skip to content

Commit

Permalink
Update and simplify documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
vfisikop committed Mar 15, 2024
1 parent 795e948 commit 9114f37
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 106 deletions.
47 changes: 11 additions & 36 deletions docs/getting_started/cpp_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -30,8 +29,7 @@ int main() {
double e = 0.1;

// Calculating volume of the passed polytope
double volume = volume_cooling_balls
<BallWalk, RNGType, HPolytopeType>(HP, e, walk_len).second;
double volume = volume_cooling_balls<BallWalk, RNGType, HPolytopeType>(HP, e, walk_len).second;

std::cout << "Volume of the cube: " << volume << std::endl;

Expand All @@ -46,52 +44,29 @@ 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()
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.
Expand Down
45 changes: 3 additions & 42 deletions docs/getting_started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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

Expand Down
7 changes: 0 additions & 7 deletions docs/getting_started/r_example.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 0 additions & 20 deletions docs/misc/documentation.md

This file was deleted.

0 comments on commit 9114f37

Please sign in to comment.