Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Matthias Mayr
limbo
Commits
e1f4ac32
Commit
e1f4ac32
authored
Oct 29, 2015
by
Federico Allocati
Browse files
Fixed includes in examples and tests to use only necessary files
parent
88b29bb0
Changes
11
Show whitespace changes
Inline
Side-by-side
src/examples/mono_dim.cpp
View file @
e1f4ac32
//#define SHOW_TIMER
#include <
boost/fusion/container/vector
.hpp>
#include <
boost/fusion/include/vector
.hpp>
#include <limbo/
limbo
.hpp>
#include <limbo/
inner_opt/cmaes
.hpp>
#include <limbo/tools/macros.hpp>
#include <
limbo/kernel/matern_five_halfs
.hpp>
#include <
limbo/mean/data
.hpp>
#include <limbo/model/gp.hpp>
#include <limbo/
acqui/ucb
.hpp>
#include <limbo/
bayes_opt/boptimizer
.hpp>
using
namespace
limbo
;
...
...
@@ -53,7 +53,6 @@ struct fit_eval {
int
main
()
{
typedef
kernel
::
MaternFiveHalfs
<
Params
>
Kernel_t
;
typedef
mean
::
Data
<
Params
>
Mean_t
;
typedef
model
::
GP
<
Params
,
Kernel_t
,
Mean_t
>
GP_t
;
...
...
src/examples/obs_multi.cpp
View file @
e1f4ac32
//#define SHOW_TIMER
#include <
boost/fusion/container/vector
.hpp>
#include <
boost/fusion/include/vector
.hpp>
#include <limbo/
limbo
.hpp>
#include <limbo/
inner_opt/cmaes
.hpp>
#include <limbo/tools/macros.hpp>
#include <
limbo/kernel/matern_five_halfs
.hpp>
#include <
limbo/mean/data
.hpp>
#include <limbo/model/gp.hpp>
#include <limbo/
acqui/gp_ucb
.hpp>
#include <limbo/
bayes_opt/boptimizer
.hpp>
using
namespace
limbo
;
...
...
@@ -14,10 +14,6 @@ struct Params {
struct
cmaes
:
public
defaults
::
cmaes
{
};
struct
ucb
{
BO_PARAM
(
float
,
alpha
,
0.1
);
};
struct
kf_maternfivehalfs
{
BO_PARAM
(
float
,
sigma
,
1
);
BO_PARAM
(
float
,
l
,
0.2
);
...
...
src/examples/obs_multi_auto_mean.cpp
View file @
e1f4ac32
//#define SHOW_TIMER
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/include/vector.hpp>
#include <limbo/limbo.hpp>
#include <limbo/inner_opt/cmaes.hpp>
#include <limbo/tools/macros.hpp>
#include <limbo/kernel/squared_exp_ard.hpp>
#include <limbo/mean/function_ard.hpp>
#include <limbo/model/gp_auto_mean.hpp>
#include <limbo/bayes_opt/boptimizer.hpp>
using
namespace
limbo
;
struct
Params
{
// struct gp_ucb : public defaults::gp_ucb {};
struct
gp_auto_mean
{
BO_PARAM
(
int
,
n_rprop
,
100
);
BO_PARAM
(
int
,
rprop_restart
,
10
);
...
...
@@ -18,10 +15,6 @@ struct Params {
struct
cmaes
:
public
defaults
::
cmaes
{
};
struct
ucb
{
BO_PARAM
(
float
,
alpha
,
0.1
);
};
struct
kf_maternfivehalfs
{
BO_PARAM
(
float
,
sigma
,
1
);
BO_PARAM
(
float
,
l
,
0.2
);
...
...
src/limbo/tools/rand.hpp
View file @
e1f4ac32
...
...
@@ -39,6 +39,7 @@
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <list>
#include <stdlib.h>
#include <boost/swap.hpp>
...
...
src/tests/bo_functions.cpp
View file @
e1f4ac32
//#define SHOW_TIMER
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#ifdef USE_TBB
#include <tbb/task_scheduler_init.h>
#include <tbb/parallel_for.h>
#include <tbb/concurrent_hash_map.h>
#include <map>
#else
#endif
#include <limbo/limbo.hpp>
#include <limbo/inner_opt/cmaes.hpp>
#include <limbo/tools/parallel.hpp>
#include <Eigen/Core>
#include "default_params.hpp"
#include <limbo/tools/macros.hpp>
#include <limbo/bayes_opt/boptimizer.hpp>
#include <limbo/tools/parallel.hpp>
using
namespace
limbo
;
using
namespace
tests
;
static
constexpr
int
nb_replicates
=
4
;
...
...
@@ -205,8 +209,6 @@ struct Params {
};
};
// BO_DECLARE_DYN_PARAM(double, Params::meanconstant, constant);
template
<
typename
T
>
void
print_res
(
const
T
&
r
)
{
...
...
@@ -248,22 +250,6 @@ bool is_in_argv(int argc, char** argv, const char* needle)
return
!
(
it
==
argv
+
argc
);
}
template
<
typename
F
>
void
replicate
(
const
F
&
f
,
size_t
nb
)
{
#ifdef USE_TBB
static
tbb
::
task_scheduler_init
init
;
tbb
::
parallel_for
(
size_t
(
0
),
nb
,
size_t
(
1
),
[
&
](
size_t
i
)
{
// clang-format off
f
();
// clang-format on
});
#else
for
(
size_t
i
=
0
;
i
<
nb
;
i
++
)
f
();
#endif
}
template
<
typename
T1
,
typename
T2
>
void
add_to_results
(
const
char
*
key
,
T1
&
map
,
const
T2
&
p
)
{
...
...
@@ -276,7 +262,6 @@ void add_to_results(const char* key, T1& map, const T2& p)
int
main
(
int
argc
,
char
**
argv
)
{
tools
::
par
::
init
();
typedef
bayes_opt
::
BOptimizer
<
Params
>
Opt_t
;
#ifdef USE_TBB
typedef
tbb
::
concurrent_hash_map
<
std
::
string
,
std
::
vector
<
std
::
pair
<
double
,
double
>>>
...
...
@@ -288,6 +273,8 @@ int main(int argc, char** argv)
#endif
res_t
results
;
typedef
bayes_opt
::
BOptimizer
<
Params
>
Opt_t
;
if
(
!
is_in_argv
(
argc
,
argv
,
"--only"
)
||
is_in_argv
(
argc
,
argv
,
"sphere"
))
tools
::
par
::
replicate
(
nb_replicates
,
[
&
]()
{
// clang-format off
...
...
src/tests/default_params.hpp
deleted
100644 → 0
View file @
88b29bb0
#ifndef BO_DEFAULT_PARAMS_HPP
#define BO_DEFAULT_PARAMS_HPP
namespace
limbo
{
namespace
tests
{
namespace
def
{
struct
cmaes
{
BO_PARAM
(
double
,
stopMaxFunEvals
,
1e5
);
BO_PARAM
(
double
,
stopMaxIter
,
1e5
);
BO_PARAM
(
double
,
stopTolFun
,
1e-5
);
BO_PARAM
(
double
,
stopTolFunHist
,
1e-6
);
BO_PARAM
(
int
,
nb_pts
,
20
);
BO_PARAM
(
bool
,
discrete
,
false
);
};
}
}
}
#endif
src/tests/test_gp.cpp
View file @
e1f4ac32
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE p
arallel
#define BOOST_TEST_MODULE
g
p
#include <boost/test/unit_test.hpp>
#include <limbo/tools/macros.hpp>
#include <limbo/kernel/matern_five_halfs.hpp>
#include <limbo/mean/constant.hpp>
#include <limbo/model/gp.hpp>
using
namespace
limbo
;
...
...
src/tests/test_gp_auto.cpp
View file @
e1f4ac32
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE
parallel
#define BOOST_TEST_MODULE
gp_auto
#include <boost/test/unit_test.hpp>
#include <limbo/tools/macros.hpp>
#include <limbo/kernel/squared_exp_ard.hpp>
#include <limbo/mean/constant.hpp>
#include <limbo/model/gp_auto.hpp>
#include <fstream>
...
...
src/tests/test_init_functions.cpp
View file @
e1f4ac32
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE initctions
#define BOOST_TEST_MODULE init
_fun
ctions
#include <boost/test/unit_test.hpp>
#include <limbo/limbo.hpp>
#include <limbo/inner_opt/cmaes.hpp>
#include <limbo/tools/macros.hpp>
#include <limbo/init.hpp>
#include <limbo/acqui.hpp>
#include <limbo/bayes_opt/boptimizer.hpp>
using
namespace
limbo
;
...
...
src/tests/test_inner_opti.cpp
View file @
e1f4ac32
...
...
@@ -3,7 +3,9 @@
#include <boost/test/unit_test.hpp>
#include <limbo/limbo.hpp>
#include <limbo/tools/macros.hpp>
#include <limbo/inner_opt.hpp>
#include <limbo/bayes_opt/bo_base.hpp>
using
namespace
limbo
;
...
...
src/tests/test_macros.cpp
View file @
e1f4ac32
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE
parallel
#define BOOST_TEST_MODULE
macros
#include <boost/test/unit_test.hpp>
#include <cstring>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment