/
main-5a.cpp
59 lines (43 loc) · 1.67 KB
/
main-5a.cpp
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
//Copyright © 2017-2018 Gustavo Thebit Pfeiffer / Y. Sato laboratory
/*
This file is part of PS-MCLS2018.
PS-MCLS2018 is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
PS-MCLS2018 is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PS-MCLS2018. If not, see <http://www.gnu.org/licenses/>.
*/
#include "methods.h"
#include "problems.h"
using namespace std;
int main() {
srand(time(NULL));
//srand(0);
const unsigned int n = 2;
const unsigned int m = 3;
Probl1 problem;
Vec<n> x0, xstar;
xstar = problem.xstar();
x0[0] = 2;
x0[1] = 1;
DISP(x0.transpose())
Method<n> * f[] = {
new SGN<n,m>(&problem, "SGN", 1., 0., forget_pow<2,1,1,2>),
new AvgSGN<n,m>(&problem, "aSGN", 1., .75, forget_lin<2,1>),
new Bordes<n,m>(&problem, "Bordes2009", 20, .1, 1.),
new Wang<n,m>(&problem, "Wang2015", 20, 0, 1.),
new AdaGradHybrid<n,m>(&problem, "IP-AdaGrad Hybrid", .1, forget_lin<2,1>),
new AdamSqrtHybrid<n,m>(&problem, "IP-Adam Hybrid", forget_lin<2,1>, 0, .1),
new AdamHybridAvg<n,m>(&problem, "Avg IP-Adam Hybrid", forget_lin<2,1>, .75, 1.),
};
const int nf = sizeof(f)/sizeof(f[0]);
compareSeveral<n>(f, nf, 1000, x0, xstar);
for(int i = 0; i < nf; i++)
delete f[i];
return 0;
}