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
c39a52bd
Commit
c39a52bd
authored
Aug 10, 2014
by
Jean-Baptiste Mouret
Browse files
ready for the first benchmark
parent
a6eab970
Changes
8
Hide whitespace changes
Inline
Side-by-side
limbo.py
View file @
c39a52bd
...
...
@@ -11,6 +11,8 @@ except:
import
glob
def
options
(
opt
):
opt
.
add_option
(
'--qsub'
,
type
=
'string'
,
help
=
'json file to submit to torque'
,
dest
=
'qsub'
)
def
create_variants
(
bld
,
source
,
uselib_local
,
uselib
,
variants
,
includes
=
". ../"
,
...
...
src/benchmarks/multi.cpp
View file @
c39a52bd
...
...
@@ -10,7 +10,11 @@ struct Params {
BO_PARAM
(
int
,
dump_period
,
1
);
};
struct
init
{
#ifdef ZDT2
BO_PARAM
(
int
,
nb_samples
,
50
);
#else
BO_PARAM
(
int
,
nb_samples
,
10
);
#endif
// calandra: number of dimensions * 5
// knowles : 11 * dim - 1
};
...
...
@@ -61,16 +65,17 @@ struct mop2 {
};
namespace
limbo
{
namespace
stat
{
template
<
typename
F
>
struct
ParetoBenchmark
{
template
<
typename
BO
>
void
operator
()(
const
BO
&
opt
)
{
void
operator
()(
BO
&
opt
)
{
opt
.
update_pareto_data
();
opt
.
template
update_pareto_model
<
2
>();
//2 = hack..
auto
dir
=
opt
.
res_dir
()
+
"/"
;
auto
p_model
=
opt
.
model_
pareto_
front
();
auto
p_data
=
opt
.
data_
pareto_
front
();
auto
p_model
=
opt
.
pareto_
model
();
auto
p_data
=
opt
.
pareto_
data
();
std
::
string
it
=
std
::
to_string
(
opt
.
iteration
());
std
::
string
model
=
dir
+
"pareto_model_"
+
it
+
".dat"
;
std
::
string
model_real
=
dir
+
"pareto_model_real_"
+
it
+
".dat"
;
...
...
@@ -106,11 +111,12 @@ int main() {
# error "unknown function to optimize"
#endif
typedef
stat
::
ParetoBenchmark
<
func_t
>
stat_t
;
#ifdef NS_EGO
NsEgo
<
Params
,
stat_fun
<
stat
::
ParetoBenchmark
<
func_t
>
>
>
opt
;
NsEgo
<
Params
,
stat_fun
<
stat
_t
>
>
opt
;
#else
Parego
<
Params
,
stat_fun
<
stat
::
ParetoBenchmark
<
func_t
>
>
>
opt
;
Parego
<
Params
,
stat_fun
<
stat
_t
>
>
opt
;
#endif
opt
.
optimize
(
func_t
());
...
...
src/benchmarks/wscript
View file @
c39a52bd
...
...
@@ -5,7 +5,7 @@ def build(bld):
limbo
.
create_variants
(
bld
,
source
=
'multi.cpp'
,
uselib_local
=
'limbo'
,
uselib
=
'
SFERES TBB
BOOST EIGEN'
,
uselib
=
'BOOST EIGEN
TBB SFERES
'
,
variants
=
[
'PAREGO ZDT2'
,
'PAREGO MOP2'
,
'NS_EGO ZDT2'
,
...
...
src/limbo/bo_base.hpp
View file @
c39a52bd
...
...
@@ -10,6 +10,8 @@
#include
<boost/fusion/include/accumulate.hpp>
#include
<boost/fusion/container/vector.hpp>
#include
<boost/fusion/include/vector.hpp>
#define BOOST_NO_SCOPED_ENUMS
#include
<boost/filesystem.hpp>
#include
<Eigen/Core>
...
...
@@ -38,9 +40,9 @@ namespace limbo {
template
<
typename
BO
>
struct
RefreshStat_f
{
RefreshStat_f
(
const
BO
&
bo
)
:
_bo
(
bo
)
{
RefreshStat_f
(
BO
&
bo
)
:
_bo
(
bo
)
{
}
const
BO
&
_bo
;
BO
&
_bo
;
template
<
typename
T
>
void
operator
()
(
T
&
x
)
const
{
x
(
_bo
);
...
...
@@ -95,7 +97,6 @@ namespace limbo {
typedef
stat
::
Acquisitions
<
Params
>
stat_t
;
//5
typedef
boost
::
fusion
::
vector
<
stopping_criterion
::
MaxIterations
<
Params
>
>
stop_t
;
//6
typedef
double
obs_t
;
//7
};
// extract the types
...
...
src/limbo/bo_multi.hpp
View file @
c39a52bd
...
...
@@ -68,7 +68,6 @@ namespace limbo {
template
<
class
Params
,
class
A1
=
boost
::
parameter
::
void_
,
class
A2
=
boost
::
parameter
::
void_
,
class
A3
=
boost
::
parameter
::
void_
,
class
A4
=
boost
::
parameter
::
void_
...
...
@@ -99,16 +98,15 @@ namespace limbo {
return
_pareto_data
;
}
// will be
automatically
called at the end of the algo
// will be called at the end of the algo
void
update_pareto_data
()
{
std
::
vector
<
Eigen
::
VectorXd
>
v
(
this
->
_samples
.
size
());
size_t
dim
=
this
->
_observations
[
0
].
size
();
std
::
fill
(
v
.
begin
(),
v
.
end
(),
Eigen
::
VectorXd
::
Zero
(
dim
));
_pareto_data
=
pareto
::
pareto_set
(
_pack_data
(
this
->
_samples
,
this
->
_observations
,
v
));
}
}
// will be automatically called at the end of the algo
// will be called at the end of the algo
template
<
int
D
>
void
update_pareto_model
()
{
this
->
_update_models
();
...
...
src/limbo/ns_ego.hpp
View file @
c39a52bd
...
...
@@ -43,6 +43,7 @@ namespace limbo {
protected:
void
_update_stats
()
{
std
::
cout
<<
"stats"
<<
std
::
endl
;
boost
::
fusion
::
for_each
(
this
->
_stat
,
RefreshStat_f
<
NsEgo
>
(
*
this
));
}
...
...
src/limbo/parego.hpp
View file @
c39a52bd
...
...
@@ -56,8 +56,8 @@ namespace limbo {
}
this
->
template
update_pareto_model
<
EvalFunction
::
dim
>();
this
->
update_pareto_data
();
}
protected:
void
_update_stats
()
{
boost
::
fusion
::
for_each
(
this
->
_stat
,
RefreshStat_f
<
Parego
>
(
*
this
));
...
...
wscript
View file @
c39a52bd
...
...
@@ -9,6 +9,7 @@ blddir = 'build'
import
copy
import
os
,
sys
import
limbo
def
options
(
opt
):
opt
.
load
(
'compiler_cxx boost waf_unit_test'
)
...
...
@@ -16,7 +17,8 @@ def options(opt):
opt
.
load
(
'eigen'
)
opt
.
load
(
'tbb'
)
opt
.
load
(
'sferes'
)
opt
.
load
(
'limbo'
)
def
configure
(
conf
):
print
(
"configuring b-optimize"
)
conf
.
load
(
'compiler_cxx boost waf_unit_test'
)
...
...
@@ -25,12 +27,12 @@ def configure(conf):
conf
.
load
(
'tbb'
)
conf
.
load
(
'sferes'
)
common_flags
=
"-Wall -std=c++11
-fcolor-diagnostics
"
common_flags
=
"-Wall -std=c++11"
cxxflags
=
conf
.
env
[
'CXXFLAGS'
]
conf
.
check_boost
(
lib
=
'serialization timer filesystem
\
system unit_test_framework program_options
\
graph mpi
python
thread'
,
graph mpi thread'
,
min_version
=
'1.35'
)
conf
.
check_eigen
()
conf
.
check_tbb
()
...
...
@@ -53,3 +55,8 @@ def build(bld):
bld
.
recurse
(
'src/benchmarks'
)
from
waflib.Tools
import
waf_unit_test
bld
.
add_post_fun
(
waf_unit_test
.
summary
)
def
shutdown
(
ctx
):
if
ctx
.
options
.
qsub
:
limbo
.
qsub
(
ctx
.
options
.
qsub
)
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