MCPcopy Create free account
hub / github.com/Niko1221/Strata / best_rate

Function best_rate

engine/src/split/tools/batch_plan_test.cpp:29–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29double best_rate(const std::vector<fnx::RowOffer>& L, double base, const fnx::RowCost& c) {
30 std::vector<int> d(L.size(), 0);
31 double best = 0.0;
32 std::function<void(size_t, int)> go = [&](size_t i, int left) {
33 if (i == L.size()) {
34 best = std::max(best, rate(L, d, base, c));
35 return;
36 }
37 for (int k = 0; k <= std::min(L[i].avail, left); ++k) {
38 d[i] = k;
39 go(i + 1, left - k);
40 }
41 d[i] = 0;
42 };
43 go(0, ROWS - (int) L.size());
44 return best;
45}
46} // namespace
47
48int main() {

Callers 1

mainFunction · 0.85

Calls 5

rateFunction · 0.70
maxFunction · 0.50
minFunction · 0.50
goFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected