Skip to content

Commit

Permalink
Max ball param in generate_samples and rounding (#115)
Browse files Browse the repository at this point in the history
* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update setup.py

* Update bindings.h

* Update setup.py

* Update setup_old.py

* Update bindings.cpp

* Update setup.py

* Update setup.py

* Update volestipy.pyx

* Update test1.py

* Create test1_old.py

* Update test1.py

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update bindings.h

* Update bindings.cpp

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update bindings.h

* Update bindings.cpp

* Update bindings.h

* Update setup.py

* Update bindings.cpp

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update volume_cb_hpolytope.cpp

* Update test1.py

* Update bindings.cpp

* Update test1.py

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Create .gitignore

* Delete test1_old.py

* Delete setup_old.py

* Delete bindings_old.h

* Delete bindings_old.cpp

* Delete volestipy_old.pyx

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update .gitignore

* Update volume_cb_hpolytope.cpp

* Update test1.py

* Update test2.py

* Update bindings.h

* Update setup.py

* Update credits.md

* on .gitignore: files on test/Testing/Temporary/ were removed from the .gitignore file

* first attempt - not working - for rounding

* rounding function: does not work; trying to figure it out

* round_val now works; still new_A and new_b need to be included

* Create metabolic_net_pipeline.ipynb

* Update metabolic_net_pipeline.ipynb

* Update metabolic_net_pipeline.ipynb

* Update metabolic_net_pipeline.ipynb

* Update metabolic_net_pipeline.ipynb

* Update metabolic_net_pipeline.ipynb

* Update volestipy.pyx

* Update bindings.cpp

* Create test_rounding.py

* Create test1.py

* Create test2.py

* Delete test2.py

* Update test1.py

* Create metabolic_net_pipeline-checkpoint.ipynb

* Update setup.py

* Update .gitignore

* Delete test1.py

git rm test1.py

* Delete test2.py

git rm test2.py

* Update bindings.h

new class for the preprocessing and the get_full_dimensional_polytope() function in the bindings.h

* Update bindings.cpp

new class for the preprocessing and the get_full_dimensional_polytope() function in the bindings.cpp

* Update volestipy.pyx

new class for the preprocessing and the get_full_dimensional_polytope() function in the volestipy.pyx

* Update bindings.h

working on the lowDimHPolytopeCPP class - just a draft with the main ideas, not a stable version

* Update bindings.cpp

working on the lowDimHPolytopeCPP class - just a draft with the main ideas, not a stable version

* Update volestipy.pyx

working on the lowDimHPolytopeCPP class - just a draft with the main ideas, not a stable version

* Update bindings.h

set member variables for lowDimHPolytopeCPP class

* Update bindings.cpp

remove unessecary vars

* Update volestipy.pyx

remove unecessary vars in self.full_dim_polytope

* Update bindings.h

build the instructor for the full_dimensional_polytope() function

* Update bindings.cpp

1st draft for the get_full_dimensional_polytope() function

* Update volestipy.pyx

1st draft for the python interface of the get_full_dimensional_polytope() function

* Update bindings.h

using transpose matrices for N and A_full
removing the "extra" from the shift and b_full vectors as it is not needed

* Update bindings.cpp

2nd draft for the lowDimHPolytopeCPP class.
we changed the N and A_full matrices to transpose to feed them in the cpp file like this.
we removed the _extra from the vectors

* Update volestipy.pyx

2nd draft for the lowDimHPolytopeCPP class.
changed "_extra" vectors when needed.
first draft that actually compiles

* Create test_get_full_dim_polytope.py

test file for the get_full_dimensional_polytope function
not ready yet

* Update test_get_full_dim_polytope.py

changed the Aeq

* Update test_get_full_dim_polytope.py

final test for the get_full_dimensional_polytope() function

* Update bindings.cpp

print the N transpose and the full A transpose matrices from the C++ code

* Update volestipy.pyx

Attention! What C++ returns is the transpose matrix.
Thus, the [i,j] element of the full A is the [j,i] of what C++ returns. That is what we fixed here

* Update test_get_full_dim_polytope.py

print all the outputs of the get_full_dimensional_polytope() function

* Update bindings.cpp

remove test prints

* Update volestipy.pyx

remove test printing statements
add all the output in the return statement on the get_full_dim_polytope()
improved comments

* Delete metabolic_net_pipeline.ipynb

remove the jupyter notebook

* Delete metabolic_net_pipeline-checkpoint.ipynb

remove the hidden directory for the jupyter notebook

* Update volestipy.pyx

Exceptions for the low_dim_polytope_cpp constructor added.
Deletion of the A_full and the b_full variables after the initialization of the object.

* Update bindings.h

CheBall was removed from the case of the lowDimHPolytopeCPP

* Update volestipy.pyx

just some functions of gurobipy

* Update volestipy.pyx

first draft for the pre_process() python function

* Create test_preprocess.py

a test file for the pre_process() function

* Update volestipy.pyx

correct obj function. Aeq line was replaced by a such from A.

* Update volestipy.pyx

make dependencies more readable

* Update volestipy.pyx

test sparse function

* Update test_preprocess.py

change dimensions

* Update volestipy.pyx

loop for all the lines of A and models for each of those and its minus

* Update test_preprocess.py

change the dimensions

* Update volestipy.pyx

draft to check whether it works fine!

* Update volestipy.pyx

change name in model.addConstr from "c2" to "c" in all the constraints described, fixed the solutions
remove unecessary print statements

* Update test_preprocess.py

add print statement for the results of the pre_process() function

* Update test_preprocess.py

build Aeq in a way to be more like to a stoichiometric matrix

* Update volestipy.pyx

add model.update() and model.display() function every time we add constraints or change the objective function

* Update volestipy.pyx

correct typo in comment

* Update volestipy.pyx

add model.update() after the obj function for the minus A[i,]

* Update volestipy.pyx

add print statements

* Update volestipy.pyx

attempt to solve the issue with the solutions

* Update volestipy.pyx

addMConstrs

* Update volestipy.pyx

setMObjective()

* Update volestipy.pyx

correct objectives()

* Update volestipy.pyx

make minus obj function as it should be

* Update volestipy.pyx

remove print not needed statements
make code more readable

* Update test_preprocess.py

change permission in test

* Update test_preprocess.py

add import volestipy in test_preprocess.py

* Update volestipy.pyx

remove solutions and their corresponding print statements
add new line in the end of the file

* Update volestipy.pyx

correct comment

* add bigg file of e.coli in .mat format

* add a BIGG file in .json format

* add function to read bigg files in .json format; keep the Aeq

* develop the read json format bigg file function

* add test file for reading json bigg files

* add function for reading json bigg files

* new directory for the bigg example files

* improved function for reading json bigg files; Aeq is now m*n

* print metabolites and reaction in the test for json

* add function to read .mat bigg files

* one test file for reading both json and mat bigg files

* remove unecessary print statements

* comment in the head of the file describing its purpose

* update documentation on how to install volestipy

* improved documentation for the dependencies

* remember to explain how to get lpsolve

* remember to explain how to get lpsolve

* remember to explain how to get lpsolve

* remember to explain how to get lpsolve

* test with RECON1 for the pre-processing step were performed successfully

* export .npy files with the outcome of the pre_process function so the user can load them any time

* change the input file to e_coli_core

* print files with the output of get_full_dim() and rounding() ; start function for inner ball

* small changes to check data types

* convertions to numpy arrays

* complete read-preprocess-get_full_dim steps

* add data types in .gitignore file

* add a test with all the steps of the pipeline

* draft for max ball

* test for computing max ball

* include get_max_ball() function

* remove last empty lines

* add emppty last line

* lp_solve replaced by lpsolve

* rounding step included in the full pipeline test

* add comput_max_ball in the pipeline

* fixed type for the r variable; sre_parse related issue

* remove unecessary library

* clean up a bit

* Update volestipy.pyx

empty last line

* Update bindings.cpp

add empty last line

* improve rounding

* fix svd rounding

* add max_ball arguments in the rounding function

* add max_ball if statement in rounding funcion

* fix cheball in rounding

* change variable name

* add max ball in rounding function

* add semicolomn

* add extra variable inner_point_for_c to feed the .cpp with the inner point

* change test file to include the max ball output as parameter to the rounding function

* replace integer zero values in the bydefault inner point list, with fload zeros; this way we fixed bug according to which the inner_point_for_c was waiting for double but got long

* replace if statement for max ball in rounding

* add arguments in generate_samples() for the case that max_ball has been included

* add cases for running generate_samples depending max ball input

* feed sampling with max_ball params

* add part for generate samples

* change sampling function to support max ball and L params

* change the way set_L and max_ball bool vars are set

* python interface initialization

* add accelerated_billiard variable

* remove wrong '=' sign

* remove const from end of void set_InnerBall functions

* include sampling on rounded polytope using max ball function

* max ball on rounded polytope

* change by default number_of_points_to_burn

* complete test pipeline

* function for mapping sampled points to the initial polytope added

* remove blank lines

* remove blank line

* clean code; split long lines

* add blank last line

* add features till get full dimensional polytope

* before plotiing

* plol it

* histogram added

* reaction 35 for plotting

* add print statement for dimension

* testing recon1

* testing for recon1

* notebook checkpoints

* add returning min and max fluxes vectors in pre-processing

* ignore png files

* return float numpy types from read function

* add tests for e coli and plot samples

* e coli full example

* further chechpoints

Co-authored-by: Tolis <tolis.chal@gmail.com>
  • Loading branch information
hariszaf and TolisChal authored Sep 30, 2020
1 parent e547120 commit 1bd54f2
Show file tree
Hide file tree
Showing 19 changed files with 4,404 additions and 175 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

test/Testing/Temporary/CTestCostData.txt
*.log
.Rproj.user
*.png
2 changes: 1 addition & 1 deletion R-proj/src/volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ double volume (Rcpp::Reference P,
} else if (Rcpp::as<std::string>(rounding).compare(std::string("none")) == 0) {
rounding_method = none;
}

NT e;

if (!Rcpp::as<Rcpp::List>(settings).containsElementNamed("algorithm")) {
Expand Down
2 changes: 1 addition & 1 deletion include/convex_bodies/ballintersectconvex.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BallIntersectPolytope {
{
return P.InnerBall();
}

MT get_mat() const {
return P.get_mat();
}
Expand Down
5 changes: 5 additions & 0 deletions include/convex_bodies/hpolytope.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ class HPolytope {
return _inner_ball;
}

void set_InnerBall(std::pair<Point,NT> const& innerball) //const
{
_inner_ball = innerball;
}

//Compute Chebyshev ball of H-polytope P:= Ax<=b
//Use LpSolve library
std::pair<Point, NT> ComputeInnerBall()
Expand Down
5 changes: 5 additions & 0 deletions include/convex_bodies/vpolyintersectvpoly.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ class IntersectionOfVpoly {

}

void set_InnerBall(std::pair<Point,NT> const& innerball) const
{
_inner_ball = innerball;
}

/*
unsigned int num_of_v = 0;
unsigned int d = dimension();
Expand Down
5 changes: 5 additions & 0 deletions include/convex_bodies/vpolytope.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ class VPolytope {
return _inner_ball;
}

void set_InnerBall(std::pair<Point,NT> const& innerball) //const
{
_inner_ball = innerball;
}

// return dimension
unsigned int dimension() const {
return _d;
Expand Down
5 changes: 5 additions & 0 deletions include/convex_bodies/zpolytope.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ class Zonotope {
return _inner_ball;
}

void set_InnerBall(std::pair<Point,NT> const& innerball) //const
{
_inner_ball = innerball;
}

// return the number of generators
int num_of_generators() const
{
Expand Down
2 changes: 1 addition & 1 deletion include/preprocess/max_inscribed_ellipsoid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,4 @@ std::pair<std::pair<MT, VT>, bool> max_inscribed_ellipsoid(MT A, VT b, VT const&
}


#endif
#endif
2 changes: 1 addition & 1 deletion include/preprocess/max_inscribed_ellipsoid_rounding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ std::tuple<MT, VT, NT> max_inscribed_ellipsoid_rounding(Polytope &P,
return result;
}

#endif
#endif
12 changes: 6 additions & 6 deletions include/preprocess/svd_rounding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
#define SVD_ROUNDING_HPP


template
template
<
typename WalkTypePolicy,
typename Polytope,
typename Point,
typename MT,
typename VT,
typename MT,
typename VT,
typename RandomNumberGenerator
>
void svd_on_sample(Polytope &P, Point &p, unsigned int const& num_rounding_steps, MT &V, VT &s, VT &Means,
Expand All @@ -29,7 +29,7 @@ void svd_on_sample(Polytope &P, Point &p, unsigned int const& num_rounding_steps
Polytope,
RandomNumberGenerator
> walk;

typedef RandomPointGenerator <walk> RandomPointGenerator;
PushBackWalkPolicy push_back_policy;

Expand Down Expand Up @@ -71,7 +71,7 @@ void svd_on_sample(Polytope &P, Point &p, unsigned int const& num_rounding_steps
}


template
template
<
typename WalkTypePolicy,
typename MT,
Expand All @@ -82,7 +82,7 @@ template
typename RandomNumberGenerator
>

std::tuple<MT, VT, NT> svd_rounding(Polytope &P,
std::tuple<MT, VT, NT> svd_rounding(Polytope &P,
std::pair<Point,NT> &InnerBall,
const unsigned int &walk_length,
RandomNumberGenerator &rng)
Expand Down
Loading

0 comments on commit 1bd54f2

Please sign in to comment.