Commit 6b71fc9b by Vaios Papaspyros

### Fix for best_sample and best_observation function to return feasible results...

Fix for best_sample and best_observation function to return feasible results (if there are any, otherwise return overall best)
parent ca1d13a8
 ... ... @@ -61,17 +61,6 @@ namespace limbo { namespace experimental { namespace acqui { /** @ingroup acqui \rst Constrained EI (Expected Improvement). See :cite:TODO, p. TODO .. math:: TODO Parameters: - double jitter - :math:\xi \endrst */ template class CEI { public: ... ... @@ -95,7 +84,7 @@ namespace limbo { return 0.0; // Compute constrained EI(x) // First find the best so far (predicted) observation // First find the best (predicted) observation so far // (We are zeroing infeasible samples subject to the constraint value) std::vector rewards; for (auto s : _model.samples()) ... ...
 ... ... @@ -209,6 +209,10 @@ namespace limbo { _dim_out = _model.dim_out(); _split_observations(); std::vector obs = _feasible_observations(); if (obs.size() > 0) _obs[0] = obs; auto rewards = std::vector(_obs[0].size()); std::transform(_obs[0].begin(), _obs[0].end(), rewards.begin(), afun); auto max_e = std::max_element(rewards.begin(), rewards.end()); ... ... @@ -222,6 +226,10 @@ namespace limbo { _dim_out = _model.dim_out(); _split_observations(); std::vector obs = _feasible_observations(); if (obs.size() > 0) _obs[0] = obs; auto rewards = std::vector(_obs[0].size()); std::transform(_obs[0].begin(), _obs[0].end(), rewards.begin(), afun); auto max_e = std::max_element(rewards.begin(), rewards.end()); ... ... @@ -237,6 +245,17 @@ namespace limbo { mutable size_t _dim_out; mutable std::vector> _obs; std::vector _feasible_observations() const { std::vector feasible_obs; for (size_t i = 0; i < _obs[0].size(); ++i) { if (_obs[1][i].prod() > 0) feasible_obs.push_back(_obs[0][i]); } return feasible_obs; } void _split_observations() const { _obs.clear(); ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!