Changeset 1234
- Timestamp:
- 10/26/10 18:27:09 (14 years ago)
- Location:
- applications/robust
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/robust/main.cpp
r1220 r1234 15 15 int main ( int argc, char* argv[] ) { 16 16 17 emlig* emlig1 = new emlig(8); 17 emlig* emlig1 = new emlig(3); 18 19 //emlig1->step_me(0); 18 20 19 21 for(int i = 0;i<500;i++) … … 27 29 condition[2] = rand()/1000.0; 28 30 condition[3] = rand()/1000.0; 29 condition[4] = rand()/1000.0;31 /*condition[4] = rand()/1000.0; 30 32 condition[5] = rand()/1000.0; 31 33 condition[6] = rand()/1000.0; 32 34 condition[7] = rand()/1000.0; 33 condition[8] = rand()/1000.0; 35 condition[8] = rand()/1000.0;*/ 34 36 35 37 36 vec* condition_vec = new vec(condition, 9);38 vec* condition_vec = new vec(condition,4); 37 39 emlig1->add_condition(*condition_vec); 38 40 39 //emlig1->step_me(i);41 emlig1->step_me(i); 40 42 41 43 vector<int> sizevector; -
applications/robust/robustlib.h
r1224 r1234 25 25 class polyhedron; 26 26 class vertex; 27 28 /* 29 class t_simplex 30 { 31 public: 32 set<vertex*> minima; 33 34 set<vertex*> simplex; 35 36 t_simplex(vertex* origin_vertex) 37 { 38 simplex.insert(origin_vertex); 39 minima.insert(origin_vertex); 40 } 41 };*/ 27 42 28 43 /// A class describing a single polyhedron of the split complex. From a collection of such classes a Hasse diagram … … 83 98 84 99 /// List of triangulation polyhedrons of the polyhedron given by their relative vertices. 85 list< list<vertex*>> triangulations;100 list<set<vertex*>> triangulation; 86 101 87 102 /// A list of relative addresses serving for Hasse diagram construction. … … 155 170 } 156 171 172 void triangulate() 173 { 174 for(list<polyhedron*>::iterator child_ref = children.begin();child_ref!=children.end();child_ref++) 175 { 176 for(list<set<vertex*>>::iterator t_ref = (*child_ref)->triangulation.begin();t_ref!=(*child_ref)->triangulation.end();t_ref++) 177 { 178 set<vertex*> new_simplex; 179 new_simplex.insert((*t_ref).begin(),(*t_ref).end()); 180 181 pair<set<vertex*>::iterator,bool> ret_val = new_simplex.insert(*vertices.begin()); 182 183 if(ret_val.second == true) 184 { 185 triangulation.push_back(new_simplex); 186 } 187 } 188 } 189 } 190 157 191 158 192 }; … … 178 212 { 179 213 this->coordinates = coordinates; 214 215 vertices.insert(this); 216 217 set<vertex*> vert_simplex; 218 219 vert_simplex.insert(this); 220 221 triangulation.push_back(vert_simplex); 180 222 } 181 223 … … 855 897 negative_poly->vertices.insert(new_totally_neutral_child->vertices.begin(),new_totally_neutral_child->vertices.end()); 856 898 899 new_totally_neutral_child->triangulate(); 900 901 positive_poly->triangulate(); 902 negative_poly->triangulate(); 903 857 904 statistic.append_polyhedron(k-1, new_totally_neutral_child); 858 905 … … 897 944 // We create an origin - this point will have all the coordinates zero, but now it has an empty vector of coords. 898 945 vertex *origin = new vertex(origin_coord); 899 900 // It has itself as a vertex. There will be a nice use for this when the vertices of its parents are searched in 901 // the recursive creation procedure below. 902 origin->vertices.insert(origin); 903 946 904 947 /* 905 948 // As a statistic, we have to create a vector of vectors of polyhedron pointers. It will then represent the Hasse … … 933 976 934 977 // Now we create the points 935 vertex *new_point1 = new vertex(origin_coord1); 936 vertex *new_point2 = new vertex(origin_coord2); 937 938 new_point1->vertices.insert(new_point1); 939 new_point2->vertices.insert(new_point2); 978 vertex* new_point1 = new vertex(origin_coord1); 979 vertex* new_point2 = new vertex(origin_coord2); 940 980 941 981 //********************************************************************************************************* … … 1032 1072 // The only new vertex of the offspring should be the newly created point. 1033 1073 current_copy1->vertices.insert(new_point1); 1034 current_copy2->vertices.insert(new_point2); 1074 current_copy2->vertices.insert(new_point2); 1035 1075 1036 1076 // This method guarantees that each polyhedron is already triangulated, therefore its triangulation 1037 1077 // is only one set of vertices and it is the set of all its vertices. 1038 list<vertex*> triangulation1; 1039 list<vertex*> triangulation2; 1040 1041 set<vertex*>::iterator copy2_ref = current_copy2->vertices.begin(); 1042 for(set<vertex*>::iterator copy1_ref = current_copy1->vertices.begin(); copy1_ref != current_copy1->vertices.end(); copy1_ref++) 1043 { 1044 triangulation1.push_back(*copy1_ref); 1045 triangulation2.push_back(*copy2_ref); 1046 1047 copy2_ref++; 1048 } 1049 1050 current_copy1->triangulations.push_back(triangulation1); 1051 current_copy2->triangulations.push_back(triangulation2); 1078 set<vertex*> t_simplex1; 1079 set<vertex*> t_simplex2; 1080 1081 t_simplex1.insert(current_copy1->vertices.begin(),current_copy1->vertices.end()); 1082 t_simplex2.insert(current_copy2->vertices.begin(),current_copy2->vertices.end()); 1083 1084 current_copy1->triangulation.push_back(t_simplex1); 1085 current_copy2->triangulation.push_back(t_simplex2); 1052 1086 1053 1087 // Now we have copied the polyhedron and we have to copy all of its relations. Because we are copying