| 70 | } |
| 71 | |
| 72 | void add ( |
| 73 | const function_evaluation& point |
| 74 | ) |
| 75 | { |
| 76 | DLIB_CASSERT(point.x.size() != 0, "The vectors can't be empty."); |
| 77 | if (points.size() == 0) |
| 78 | { |
| 79 | points.push_back(point); |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | DLIB_CASSERT(point.x.size() == dimensionality(), "All the vectors given to upper_bound_function must have the same dimensionality."); |
| 84 | |
| 85 | if (points.size() < 4) |
| 86 | { |
| 87 | points.push_back(point); |
| 88 | *this = upper_bound_function(points, relative_noise_magnitude, solver_eps); |
| 89 | return; |
| 90 | } |
| 91 | |
| 92 | points.push_back(point); |
| 93 | // add constraints between the new point and the old points |
| 94 | for (size_t i = 0; i < points.size()-1; ++i) |
| 95 | active_constraints.push_back(std::make_pair(i,points.size()-1)); |
| 96 | |
| 97 | learn_params(); |
| 98 | } |
| 99 | |
| 100 | long num_points( |
| 101 | ) const |
no test coverage detected