-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* expose Spectrahedron interface to R - create class spectrahedron - expose function to write sdpa format files in R * expose read_sdpa function to R and documentation * R documentation and examples - fix examples - add data for example - add roxygen comments * tests for sdpa format manager - add copyrights headers - add test that writes and reads a sdpa format file - add the test in test/CMakeLists.txt * add example code for sdpa files - create folder examples in root - add an example main to read / write sdpa format files * fix file format * fix file encoding * use soft wrap with lines * create folder spectrahedra - move in new folder spectrahedron.h, LMI.h - update CMakeLists.txt in folder examples, tests - update Makevars in R-prog/src and in cran_gen - add documentation for sdpa file example * examples/spectrahedra documentation * examples/spectrahedra documentation fix headers * rename R modules - rename module in polytopes_modules.cpp to "polytopes" - rename module in spectrahedron_module.cpp to "spectrahedron" - fix dates in copyrights headers in files - add a newline in end of file spectrahedron.h * make LMI::getMatrices() return std::vector const & Also fix parameters documentation in R for functions - readSDPAFormatFile - loadSDPAFormatFile - writeSDPAFormatFile * rename typedefs in spectrahedron.cpp - rename SPECTRAHEDRON typedef to Spectrahedron - remove unneeded class _Spectrahedron in spectrahedron.cpp * SDP Solver Simulated annealing for spectrahedra - add libraries spectra, arpack - add random walks Hamiltonian monte carlo with reflections under Boltzmann distribution and coordinate Hit and Run - in folder matrices there are the classes solving the required eigenvalue problems * fix test/SDP/CMakeLists.txt to include dependencies * fix test/SDP/CMakeLists.txt fix libgfortran * refactor - rename folder matrices to matrix_operations - refactor boltzmann_hmc_walk.hpp to follow the style of the rest random walks - in boost_random_number_generator.hpp create a default (empty) constructor * add example boltzmannHmcWalk.cpp - update examples/spectrahedron/README.md - remove files CoordinateDirectionsHitAndRun_RandomWalk.h and optimization/SDPA-FormatManager.h (duplicate) * fix type * add examples/spectrahedra/semidefiniteProgramming.cpp - fix bug in SimulatedAnnealing.h (minor - missed from previous refactor) - update examples/spectrahedra/readme.md - EigenvaluesProblems.h when calling arpack method findEigenvalues() make sure ncv <= number of rows of matrix * refactor - rename files to match package - in the simulated_annealing.hpp destroy the class and expose the functionality as free functions - update examples and README.md * add tests Add tests in folder tests/SDP to test the sdp solver and the boundary oracles.They have their own CMakeLists.txt * fix README.mde compilation instructions * fix README.md * fix include * fix errors from previous merge Accept everything as was in upstream/develop * newline in end of file * remove wrong #include causes error with R interface * add #include required by spectrahedron.h * add \dontrun{} in R example * try fix in cmakefiles * Create testSDP.yml * try fix in cmakefiles * try fix in cmakefiles * try fix in cmakefiles * fix CMakeLists.txt and readne.md * fix cmakelists (#2) Co-authored-by: Tolis Chalkis <[email protected]>
- Loading branch information
1 parent
5e4249b
commit 088a397
Showing
152 changed files
with
42,191 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: gcc-test-SDP | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.compilers }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
compilers: [g++-4.8, g++-5, g++-6, g++-7, g++-8, g++-9] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- run: sudo apt-get update || true; | ||
sudo apt-get install ${{ matrix.compilers }} lp-solve; | ||
sudo apt install gfortran libopenblas-dev liblapack-dev libarpack2-dev; | ||
sudo apt install git; | ||
sudo apt install libpthread-stubs0-dev; | ||
git clone https://github.com/m-reuter/arpackpp; | ||
cd arpackpp; | ||
./install-openblas.sh; | ||
./install-arpack-ng.sh; | ||
cp -r external ../test/SDP; | ||
cd ../; | ||
rm -rf buildSDP; | ||
mkdir buildSDP; | ||
cd buildSDP; | ||
cmake -D CMAKE_CXX_COMPILER=${{ matrix.compilers }} ../test/SDP; | ||
make; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// VolEsti (volume computation and sampling library) | ||
|
||
// Copyright (c) 20012-2018 Vissarion Fisikopoulos | ||
// Copyright (c) 2018 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 | ||
|
||
// This examples illustrates how to sample a spectrahedron under the Boltzmann distribution with | ||
// HMC random walk. It will read the spectrahedron from data/sdp_n2m3.txt. | ||
|
||
//#define VOLESTI_DEBUG | ||
|
||
|
||
#include <iostream> | ||
#include <fstream> | ||
|
||
#include "random.hpp" | ||
#include "Eigen/Eigen" | ||
#include "cartesian_geom/cartesian_kernel.h" | ||
#include "convex_bodies/spectrahedra/spectrahedron.h" | ||
#include "SDPAFormatManager.h" | ||
#include "random_walks/boltzmann_hmc_walk.hpp" | ||
|
||
typedef double NT; | ||
typedef Eigen::Matrix<NT, Eigen::Dynamic, 1> VT; | ||
typedef Eigen::Matrix <NT, Eigen::Dynamic, Eigen::Dynamic> MT; | ||
typedef Cartesian <NT> Kernel; | ||
typedef typename Kernel::Point Point; | ||
typedef Spectrahedron <NT, MT, VT> SPECTRAHEDRON; | ||
typedef BoostRandomNumberGenerator<boost::mt19937, NT> RNGType; | ||
typedef BoltzmannHMCWalk::Walk<SPECTRAHEDRON, RNGType> HmcWalk; | ||
typedef BoltzmannHMCWalk::Walk<SPECTRAHEDRON, RNGType>::Settings HmcWalkSettings; | ||
|
||
|
||
int main(int argc, char* argv[]) { | ||
std::string fileName("data/sdp_n2m3.txt"); | ||
std::string outputFile("new_sdp_n2m3.txt"); | ||
|
||
SPECTRAHEDRON spectrahedron; | ||
Point objFunction; | ||
|
||
// read the spectrahedron | ||
// open a stream to read the input file | ||
std::ifstream in; | ||
in.open(fileName, std::ifstream::in); | ||
|
||
// read the file | ||
SdpaFormatManager<NT> sdpaFormatManager; | ||
sdpaFormatManager.loadSDPAFormatFile(in, spectrahedron, objFunction); | ||
|
||
// We will need an initial interior point. In this | ||
// spectrahedron the origin (zero point) is interior | ||
Point initialPoint(spectrahedron.getLMI().dimension()); | ||
|
||
// required parameters for the random walk | ||
int walkLength = 5; | ||
RNGType randomNumberGenerator(spectrahedron.getLMI().dimension()); // this class provides random numbers | ||
NT temperature = 1; | ||
|
||
// estimate the diameter of the body | ||
int pointsNum = 10; | ||
NT diameter = spectrahedron.estimateDiameter(pointsNum, initialPoint); | ||
|
||
// declare the settings and | ||
HmcWalkSettings settings(walkLength, randomNumberGenerator, objFunction, temperature, diameter); | ||
|
||
// declare the random walk | ||
HmcWalk hmcWalk(settings); | ||
|
||
// sample three points from the spectrahedron | ||
pointsNum = 3; | ||
std::list<Point> points; | ||
hmcWalk.apply(spectrahedron, initialPoint, pointsNum, points); | ||
|
||
// print sampled points | ||
for (Point point : points) | ||
point.print(); | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.