-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathelbme_main.cpp
More file actions
67 lines (55 loc) · 1.76 KB
/
elbme_main.cpp
File metadata and controls
67 lines (55 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <iostream>
#include "Elleme.h"
using namespace std;
enum LowerBoundStrategy { MinVert, LongestEdgeLB, LowestEdgeLB, All };
enum LStrategy { Self, ParentSelf, Neighbours };
enum DivisionStrategy { LongestHalf };
enum SimplexGradientStrategy { FFMinVert, FFMaxVert, FFAllVertMean };
void partition_feasable_region_combinatoricly(GKLSFunction func, vector<Simplex*> partition){
int n = func->_D;
int number_of_simpleces = 1;
for (int i = 1; i <= n; i++) {
number_of_simpleces *= i;
};
int teta[n];
for (int i=0; i < n; i++){
teta[i] = i;
};
do {
int triangle[n+1][n];
for (int k = 0; k < n; k++) {
triangle[0][k] = 0;
};
for (int vertex=0; vertex < n; vertex++) {
for (int j = 0; j < n + 1; j++) {
triangle[vertex + 1][j] = triangle[vertex][j];
};
triangle[vertex + 1][teta[vertex]] = 1;
}
Simplex* simpl = new Simplex();
for (int i=0; i < n + 1; i++){
Point* tmp_point = new Point(triangle[i], n);
Point* point = func->get(tmp_point);
if (tmp_point != point) {
delete tmp_point;
};
simpl->add_vertex(point);
};
simpl->init_parameters(func);
partition.push_back(simpl);
} while (next_permutation(teta, teta+n));
return partition;
};
int main() {
GKLSFunction* func = new GKLSFunction(1, 1);
// partition_feasible_region
vector<Simplex*> _partition;
Elleme* alg = new Elleme();
// solve problem with one simplex from partitioned_feasible_region
Point* result = alg->minimize(simplexes[0]);
// print results
cout << result << endl;
delete alg;
delete func;
return 0;
};