Skip to content

Commit ad049d5

Browse files
authored
Merge pull request #289 from vfisikop/remove_volesti4dingo
Remove volesti4dingo branch
2 parents e767f46 + 1ae6a45 commit ad049d5

File tree

7 files changed

+39
-17
lines changed

7 files changed

+39
-17
lines changed

R-proj/src/Makevars

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ PKG_CPPFLAGS= -I../../external/boost -I../../external/LPsolve_src/run_headers -I
22

33
PKG_CXXFLAGS= -Wno-deprecated-declarations -lm -ldl -Wno-ignored-attributes -DBOOST_NO_AUTO_PTR -DDISABLE_NLP_ORACLES
44

5-
CXX_STD = CXX11
6-
75
PKG_LIBS=-LRproj_externals/lp_solve -llp_solve -L../../external/PackedCSparse/qd -lqd $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
86

97
$(SHLIB): Rproj_externals/lp_solve/liblp_solve.a ../../external/PackedCSparse/qd/libqd.a

R-proj/src/Makevars.win

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
PKG_CPPFLAGS=-I../../external/boost -I../../external/LPsolve_src/run_headers -I../../external/minimum_ellipsoid -I../../include -I../../include/convex_bodies/spectrahedra
22
PKG_CXXFLAGS= -Wno-deprecated-declarations -lm -ldl -Wno-ignored-attributes -DBOOST_NO_AUTO_PTR -DDISABLE_NLP_ORACLES
3-
CXX_STD = CXX11
43

54
PKG_LIBS=-LRproj_externals/lp_solve -llp_solve -L../../external/PackedCSparse/qd -lqd $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
65

cran_gen/Makevars

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
PKG_CPPFLAGS=-Iexternal -Iexternal/lpsolve/headers/run_headers -Iexternal/minimum_ellipsoid -Iinclude -Iinclude/convex_bodies/spectrahedra
22
PKG_CXXFLAGS= -DBOOST_NO_AUTO_PTR -DDISABLE_NLP_ORACLES
3-
CXX_STD = CXX11
43

54
PKG_LIBS=-Lexternal/lpsolve/build/lp_solve -llp_solve -Lexternal/PackedCSparse/qd -lqd $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
65

cran_gen/Makevars.win

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
PKG_CPPFLAGS=-Iexternal -Iexternal/lpsolve/headers/run_headers -Iexternal/minimum_ellipsoid -Iinclude -Iinclude/convex_bodies/spectrahedra
22
PKG_CXXFLAGS= -lm -ldl -DBOOST_NO_AUTO_PTR -DDISABLE_NLP_ORACLES
3-
CXX_STD = CXX11
43

54
PKG_LIBS=-Lexternal/lpsolve/build/lp_solve -llp_solve -Lexternal/PackedCSparse/qd -lqd $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
65

include/convex_bodies/orderpolytope.h

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,32 @@ class OrderPolytope {
208208
std::pair<Point, NT> ComputeInnerBall()
209209
{
210210
normalize();
211-
return ComputeChebychevBall<NT, Point>(_A, b);
211+
std::pair<Point, NT> inner_ball;
212+
#ifndef DISABLE_LPSOLVE
213+
inner_ball = ComputeChebychevBall<NT, Point>(_A, b); // use lpsolve library
214+
#else
215+
216+
if (inner_ball.second <= NT(0)) {
217+
218+
NT const tol = 0.00000001;
219+
std::tuple<VT, NT, bool> inner_ball = max_inscribed_ball(_A, b, 150, tol);
220+
221+
// check if the solution is feasible
222+
if (is_in(Point(std::get<0>(inner_ball))) == 0 || std::get<1>(inner_ball) < NT(0) ||
223+
std::isnan(std::get<1>(inner_ball)) || std::isinf(std::get<1>(inner_ball)) ||
224+
!std::get<2>(inner_ball) || is_inner_point_nan_inf(std::get<0>(inner_ball)))
225+
{
226+
inner_ball.second = -1.0;
227+
} else
228+
{
229+
inner_ball.first = Point(std::get<0>(inner_ball));
230+
inner_ball.second = std::get<1>(inner_ball);
231+
}
232+
}
233+
#endif
234+
235+
return inner_ball;
236+
212237
}
213238

214239

include/ode_solvers/oracle_functors.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ struct IsotropicLinearFunctor {
243243
};
244244

245245

246-
struct LinearProgramFunctor {
246+
struct ExponentialFunctor {
247247

248248
// Sample from linear program c^T x (exponential density)
249249
template <
@@ -256,8 +256,10 @@ struct LinearProgramFunctor {
256256
NT m; // Strong convexity constant
257257
NT kappa; // Condition number
258258
Point c; // Coefficients of LP objective
259+
NT a; // Inverse variance
259260

260-
parameters(Point c_) : order(2), L(1), m(1), kappa(1), c(c_) {};
261+
parameters(Point c_) : order(2), L(1), m(1), kappa(1), c(c_), a(1.0) {};
262+
parameters(Point c_, NT a_) : order(2), L(1), m(1), kappa(1), c(c_), a(a_) {};
261263

262264
};
263265

@@ -277,7 +279,7 @@ struct LinearProgramFunctor {
277279
Point operator() (unsigned int const& i, pts const& xs, NT const& t) const {
278280
if (i == params.order - 1) {
279281
Point y(params.c);
280-
return (-1.0) * y;
282+
return (-params.a) * y;
281283
} else {
282284
return xs[i + 1]; // returns derivative
283285
}
@@ -298,7 +300,7 @@ struct LinearProgramFunctor {
298300

299301
// The index i represents the state vector index
300302
NT operator() (Point const& x) const {
301-
return x.dot(params.c);
303+
return params.a * x.dot(params.c);
302304
}
303305

304306
};

test/logconcave_sampling_test.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,12 @@ void benchmark_nuts_hmc(bool truncated) {
334334
bool automatic_burnin = false;
335335
std::chrono::time_point<std::chrono::high_resolution_clock> start, stop;
336336

337-
for (unsigned int dim = dim_min; dim <= dim_max; dim+=10)
337+
for (unsigned int dim = dim_min; dim <= dim_max; dim+=10)
338338
{
339339
MT samples(dim, n_samples);
340340
Point x0(dim);
341341
NutsHamiltonianMonteCarloWalk::parameters<NT, NegativeGradientFunctor> hmc_params(F, dim);
342-
if (truncated)
342+
if (truncated)
343343
{
344344
Hpolytope P = generate_cube<Hpolytope>(dim, false);
345345

@@ -784,8 +784,8 @@ void benchmark_polytope_linear_program_optimization(
784784
typedef std::vector<Point> pts;
785785
typedef boost::mt19937 RNGType;
786786
typedef BoostRandomNumberGenerator<RNGType, NT> RandomNumberGenerator;
787-
typedef LinearProgramFunctor::GradientFunctor<Point> NegativeGradientFunctor;
788-
typedef LinearProgramFunctor::FunctionFunctor<Point> NegativeLogprobFunctor;
787+
typedef ExponentialFunctor::GradientFunctor<Point> NegativeGradientFunctor;
788+
typedef ExponentialFunctor::FunctionFunctor<Point> NegativeLogprobFunctor;
789789
typedef OptimizationFunctor::GradientFunctor<Point, NegativeLogprobFunctor,
790790
NegativeGradientFunctor> NegativeGradientOptimizationFunctor;
791791
typedef OptimizationFunctor::FunctionFunctor<Point, NegativeLogprobFunctor,
@@ -816,7 +816,7 @@ void benchmark_polytope_linear_program_optimization(
816816
}
817817

818818
// Declare oracles for LP
819-
LinearProgramFunctor::parameters<NT, Point> lp_params(coeffs);
819+
ExponentialFunctor::parameters<NT, Point> lp_params(coeffs);
820820

821821
NegativeGradientFunctor F_lp(lp_params);
822822
NegativeLogprobFunctor f_lp(lp_params);
@@ -1116,8 +1116,8 @@ void call_test_exp_sampling() {
11161116
typedef HPolytope<Point> Hpolytope;
11171117
std::string name;
11181118
std::vector<std::tuple<Hpolytope, Point, std::string, bool>> polytopes;
1119-
1120-
1119+
1120+
11211121
if (exists_check("metabolic_full_dim/e_coli_biomass_function.txt") && exists_check("metabolic_full_dim/polytope_e_coli.ine")){
11221122
Point biomass_function_e_coli = load_biomass_function<Point, NT>("metabolic_full_dim/e_coli_biomass_function.txt");
11231123
polytopes.push_back(std::make_tuple(read_polytope<Hpolytope, NT>("metabolic_full_dim/polytope_e_coli.ine"), biomass_function_e_coli, "e_coli", true));

0 commit comments

Comments
 (0)