-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from TolisChal/v_polytopes
Volume approximation for V-polytopes
- Loading branch information
Showing
37 changed files
with
1,680 additions
and
750 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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
Package: volesti | ||
Type: Package | ||
SystemRequirements: C++11 | ||
Title: Volume computation using VolEsti algorithm | ||
Version: 1.0 | ||
Date: 2018-06-28 | ||
Author: Vissarion Fisikopoulos, Chalkis Apostolos | ||
Maintainer: Chalkis Apostolos <[email protected]> | ||
Description: Package provides C++ code and a Rcpp interface for volume computation. | ||
The make function takes as input a H-polytope and apply VolEsti algorithm | ||
for volume approximation. | ||
License: GPL (>= 2) | ||
Title: Volume approximation using VolEsti and CV algorithms. | ||
Authors@R: c(person("Fisikopoulos", "Vissarion" , role=c("cph", "cre", "aut"), email="[email protected]"), | ||
person("Chalkis", "Apostolos" , role=c("cph", "ctb", "aut"), comment = "Contribution and development, as part of Google Summer of Code 2018 program", email="[email protected]")) | ||
Description: Package provides C++ code and a Rcpp interface for volume approxiation. | ||
The main function takes as input a H-polytope or a V-polytope and apply | ||
VolEsti or CV algorithm. | ||
Maintainer: Fisikopoulos Vissarion <[email protected]>, Chalkis Apostolos <[email protected]> | ||
Version: 1.0 | ||
Date: 2018-08-08 | ||
BugReports: https://github.com/vissarion/volume_approximation/issues | ||
SystemRequirements: C++11 | ||
Depends: Rcpp (>= 0.12.17), RcppEigen, lpSolveAPI, BH | ||
Imports: Rcpp (>= 0.12.17) | ||
LinkingTo: Rcpp, RcppEigen, BH | ||
Depends: Rcpp (>= 0.12.17), RcppEigen, lpSolveAPI, BH | ||
RoxygenNote: 6.0.1 |
Empty file.
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,34 @@ | ||
#' Compute the Chebychev ball of a H-polytope, P:= Ax<=b | ||
#' | ||
#' @param A the matrix of the H-polytope | ||
#' @param b the vector with the constants of the hyperplanes | ||
#' @return The Chebychev center of the Polytope discribed by the matrix \code{A} and the vector \code{b} | ||
#' @examples | ||
#' CheBall(A,b) | ||
CheBall <- function(A,b){ | ||
|
||
d=dim(A)[2] | ||
m=dim(A)[1] | ||
|
||
lprec <- make.lp(m, d+1) | ||
norm_row=rep(0,m) | ||
|
||
for(j in 1:m){ | ||
norm_row[j]=norm(A[j,],type="2") | ||
} | ||
for(i in 1:d){ | ||
set.column(lprec, i, A[,i]) | ||
} | ||
set.column(lprec, d+1, norm_row) | ||
|
||
set.objfn(lprec, c(rep(0,d),c(-1))) | ||
set.constr.type(lprec, rep("<=",m)) | ||
set.rhs(lprec, b) | ||
|
||
set.bounds(lprec, lower = rep(-Inf,d), columns = 1:d) | ||
|
||
solve(lprec) | ||
|
||
return(get.variables(lprec)) | ||
} | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Generated by using Rcpp::compileAttributes() -> do not edit by hand | ||
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 | ||
|
||
vol_R <- function(A, walk_len, e, Chebychev, annealing, win_len, N, C, ratio, frac, ball_walk, delta, coord, rounding, verbose) { | ||
.Call(`_volesti_vol_R`, A, walk_len, e, Chebychev, annealing, win_len, N, C, ratio, frac, ball_walk, delta, coord, rounding, verbose) | ||
vol_R <- function(A, walk_len, e, Chebychev, annealing, win_len, N, C, ratio, frac, ball_walk, delta, Vpoly, coord, rounding, verbose) { | ||
.Call(`_volesti_vol_R`, A, walk_len, e, Chebychev, annealing, win_len, N, C, ratio, frac, ball_walk, delta, Vpoly, coord, rounding, verbose) | ||
} | ||
|
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,20 @@ | ||
#' Run some experiments | ||
#' | ||
#' @return Print the computed volumes and the total time | ||
#' @examples | ||
#' testRvolEsti() | ||
demoVolEsti <- function(){ | ||
path=getwd() | ||
path=paste0(substr(path, start=1, stop=nchar(path)-7),'/data/') | ||
print(path) | ||
listofexamples=list.files(path) | ||
|
||
for(i in 1:length(listofexamples)){ | ||
x=read.csv(paste0(path,listofexamples[i])) | ||
print(listofexamples[i]) | ||
A=ineToMatrix(x) | ||
VolEsti(list("matrix"=A,"test"=TRUE,"verbose"=TRUE)) | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.