Commit 54d43631 authored by Konstantinos Chatzilygeroudis's avatar Konstantinos Chatzilygeroudis
Browse files

Added experimental in travis

parent 11b9e3dd
......@@ -16,14 +16,15 @@ env:
global:
- CI_HOME=`pwd`
matrix:
- LIBCMAES=ON NLOPT=ON TBB=ON
- LIBCMAES=ON NLOPT=ON TBB=OFF
- LIBCMAES=ON NLOPT=OFF TBB=ON
- LIBCMAES=ON NLOPT=OFF TBB=OFF
- LIBCMAES=OFF NLOPT=ON TBB=ON
- LIBCMAES=OFF NLOPT=ON TBB=OFF
- LIBCMAES=OFF NLOPT=OFF TBB=ON
- LIBCMAES=OFF NLOPT=OFF TBB=OFF
- LIBCMAES=ON NLOPT=ON TBB=ON EXPERIMENTAL=OFF
- LIBCMAES=ON NLOPT=ON TBB=OFF EXPERIMENTAL=OFF
- LIBCMAES=ON NLOPT=OFF TBB=ON EXPERIMENTAL=OFF
- LIBCMAES=ON NLOPT=OFF TBB=OFF EXPERIMENTAL=OFF
- LIBCMAES=OFF NLOPT=ON TBB=ON EXPERIMENTAL=OFF
- LIBCMAES=OFF NLOPT=ON TBB=OFF EXPERIMENTAL=OFF
- LIBCMAES=OFF NLOPT=OFF TBB=ON EXPERIMENTAL=OFF
- LIBCMAES=OFF NLOPT=OFF TBB=OFF EXPERIMENTAL=OFF
- LIBCMAES=OFF NLOPT=OFF TBB=OFF EXPERIMENTAL=ON
addons:
apt:
......@@ -40,4 +41,4 @@ install:
# Change this to your needs
script:
- ./waf configure
- ./waf --tests --alltests -v
- if [ "$EXPERIMENTAL" = "OFF" ]; then './waf --tests --alltests -v' ; else './waf --experimental' ; fi
......@@ -6,47 +6,48 @@
#include <hv/hypervol.h>
namespace limbo {
namespace experimental {
namespace stat {
namespace defaults {
struct stat_hyper_volume {
BO_PARAM_ARRAY(double, ref, 10, 10);
};
}
template <typename Params>
struct HyperVolume : public limbo::stat::StatBase<Params> {
template <typename BO, typename AggregatorFunction>
void operator()(const BO& bo, const AggregatorFunction&, bool blacklisted)
{
if (bo.observations().empty())
return;
if (!bo.stats_enabled())
return;
// convert the data to C arrays
double **data = new double*[bo.observations().size()];
for (size_t i = 0; i < bo.observations().size(); ++i) {
int dim = bo.observations()[i].size();
data[i] = new double[dim];
for (size_t k = 0; k < dim; ++k)
data[i][k] = bo.observations()[i](k) + Params::stat_hyper_volume::ref(k);
}
// call the hypervolume by Zitzler
int noObjectives = bo.observations()[0].size();
int redSizeFront1 = FilterNondominatedSet(data, bo.observations().size(), noObjectives);
double hv = CalculateHypervolume(data, redSizeFront1, noObjectives);
namespace experimental {
namespace stat {
namespace defaults {
struct stat_hyper_volume {
BO_PARAM_ARRAY(double, ref, 10, 10);
};
}
// write
this->_create_log_file(bo, "hypervolume.dat");
(*this->_log_file) << bo.current_iteration() <<"\t" << hv << std::endl;
template <typename Params>
struct HyperVolume : public limbo::stat::StatBase<Params> {
template <typename BO, typename AggregatorFunction>
void operator()(const BO& bo, const AggregatorFunction&, bool blacklisted)
{
if (bo.observations().empty())
return;
if (!bo.stats_enabled())
return;
// convert the data to C arrays
double** data = new double* [bo.observations().size()];
for (size_t i = 0; i < bo.observations().size(); ++i) {
size_t dim = bo.observations()[i].size();
data[i] = new double[dim];
for (size_t k = 0; k < dim; ++k)
data[i][k] = bo.observations()[i](k) + Params::stat_hyper_volume::ref(k);
}
// call the hypervolume by Zitzler
int noObjectives = bo.observations()[0].size();
int redSizeFront1 = FilterNondominatedSet(data, bo.observations().size(), noObjectives);
double hv = CalculateHypervolume(data, redSizeFront1, noObjectives);
// free data
for (size_t i = 0; i < bo.observations().size(); ++i)
delete[] data[i];
delete[] data;
}
};
// write
this->_create_log_file(bo, "hypervolume.dat");
(*this->_log_file) << bo.current_iteration() << "\t" << hv << std::endl;
// free data
for (size_t i = 0; i < bo.observations().size(); ++i)
delete[] data[i];
delete[] data;
}
};
}
}
}
}
#endif
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