summaryrefslogtreecommitdiff
path: root/src/Witness_complex/example/witness_complex_perturbations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Witness_complex/example/witness_complex_perturbations.cpp')
-rw-r--r--src/Witness_complex/example/witness_complex_perturbations.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Witness_complex/example/witness_complex_perturbations.cpp b/src/Witness_complex/example/witness_complex_perturbations.cpp
index ec7a5abe..88a7510a 100644
--- a/src/Witness_complex/example/witness_complex_perturbations.cpp
+++ b/src/Witness_complex/example/witness_complex_perturbations.cpp
@@ -194,7 +194,7 @@ void write_edges_gnuplot(std::string file_name, Witness_complex<>& witness_compl
/** Function that chooses landmarks from W and place it in the kd-tree L.
* Note: nbL hould be removed if the code moves to Witness_complex
*/
-
+/*
void landmark_choice(Point_Vector &W, int nbP, int nbL, Point_Vector& landmarks, std::vector<int>& landmarks_ind)
{
std::cout << "Enter landmark choice to kd tree\n";
@@ -216,12 +216,13 @@ void landmark_choice(Point_Vector &W, int nbP, int nbL, Point_Vector& landmarks,
//std::cout << "Added landmark " << chosen_landmark << std::endl;
}
}
-/*
+*/
+
void landmark_choice(Point_Vector &W, int nbP, int nbL, Point_Vector& landmarks, std::vector<int>& landmarks_ind)
{
std::cout << "Enter landmark choice to kd tree\n";
//std::vector<Point_d> landmarks;
- int chosen_landmark;
+ int chosen_landmark = 0;
//std::pair<Point_etiquette_map::iterator,bool> res = std::make_pair(L_i.begin(),false);
Point_d* p;
CGAL::Random rand;
@@ -229,9 +230,9 @@ void landmark_choice(Point_Vector &W, int nbP, int nbL, Point_Vector& landmarks,
{
// while (!res.second)
// {
- while (std::count(landmarks_ind.begin(),landmarks_ind.end(),chosen_landmark)!=0)
- chosen_landmark = rand.get_int(0,nbP);
- //rand++;
+ do chosen_landmark = rand.uniform_int(0,nbP);
+ while (std::find(landmarks_ind.begin(),landmarks_ind.end(),chosen_landmark) != landmarks_ind.end());
+ //rand++;
//std::cout << "Chose " << chosen_landmark << std::endl;
p = &W[chosen_landmark];
//L_i.emplace(chosen_landmark,i);
@@ -241,7 +242,7 @@ void landmark_choice(Point_Vector &W, int nbP, int nbL, Point_Vector& landmarks,
//std::cout << "Added landmark " << chosen_landmark << std::endl;
}
}
-*/
+
int landmark_perturbation(Point_Vector &W, Point_Vector& landmarks, std::vector<int>& landmarks_ind)
{
@@ -417,7 +418,8 @@ int main (int argc, char * const argv[])
}
//write_points("landmarks/initial_pointset",point_vector);
write_points("landmarks/initial_landmarks",L);
- for (int i = 0; bl != 0; i++)
+ //for (int i = 0; bl != 0; i++)
+ for (int i = 0; i < 1; i++)
{
std::cout << "========== Start iteration " << i << " ========\n";
bl = landmark_perturbation(point_vector, L, chosen_landmarks);