Commit 8a051ca1 authored by Jean-Baptiste Mouret's avatar Jean-Baptiste Mouret
Browse files

ready to try on all files!

parent 827657b6
This file is part of BayesOpt, an efficient C++ library for
Bayesian optimization.
Copyright (C) 2011-2013 Ruben Martinez-Cantin <>
BayesOpt is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BayesOpt is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with BayesOpt. If not, see <>.
#include <cmath>
#include <algorithm>
# functions to insert the license in the headers of each cpp/hpp/py/wscript file
# note that we add a pipe (|) on each line so that we can remove the license and
# reinsert it automatically
import fnmatch,re
import os, shutil, sys
license= '''Copyright Inria May 2015
This project has received funding from the European Research Council (ERC) under
the European Union's Horizon 2020 research and innovation programme (grant
agreement No 637972) - see
- Jean-Baptiste Mouret (
- Antoine Cully (
- Kontantinos Chatzilygeroudis (
- Federico Allocati (
- Vaios Papaspyros (
This software is a computer program whose purpose is to optimize continuous,
black-box functions. I mainly implements Gaussian processes and the Bayesian
optimization algorithm. Main repository:
This software is governed by the CeCILL-C license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL-C
license as circulated by CEA, CNRS and INRIA at the following URL
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C license and that you accept its terms.
def make_dirlist(folder, extensions):
matches = []
for root, dirnames, filenames in os.walk(folder):
for ext in extensions:
for filename in fnmatch.filter(filenames, '*' + ext):
matches.append(os.path.join(root, filename))
return matches
def insert_header(fname, prefix, license):
input = open(fname, 'r')
output = open('/tmp/' + fname.split('/')[-1], 'w')
for line in license.split('\n'):
output.write(prefix + line + "\n")
for line in input:
if line[0:len(prefix)] != prefix:
def insert():
# cpp
cpp = make_dirlist('src', ['.hpp', '.cpp'])
insert_header('src/benchmarks/bayesopt/testfunctions.hpp', "//| ", license)
for i in cpp:
insert_header(i, "//| ", license)
py = make_dirlist('waf_tools', ['.py'])
py += make_dirlist('.', ['wscript'])
for i in py:
insert_header(i, "#| ", license)
......@@ -4,6 +4,7 @@ import subprocess
import time
import threading
import params
import license
from waflib.Tools import waf_unit_test
json_ok = True
......@@ -242,3 +243,5 @@ def output_params(folder):
text_file = open("params_"+folder[4:]+".txt", "w")
def insert_license(): license.insert()
......@@ -160,6 +160,9 @@ def shutdown(ctx):
if ctx.options.local_serial:
def insert_license(ctx):
class BuildExtensiveTestsContext(BuildContext):
cmd = 'build_extensive_tests'
fun = 'build_extensive_tests'
......@@ -167,3 +170,7 @@ class BuildExtensiveTestsContext(BuildContext):
class BuildBenchmark(BuildContext):
cmd = 'build_benchmark'
fun = 'build_benchmark'
class InsertLicense(BuildContext):
cmd = 'insert_license'
fun = 'insert_license'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment