// El diamante con capacidades grandes: cuántas iteraciones hace Ford-Fulkerson con cada regla.
// Va con -O2 porque la regla adversaria hace millones de iteraciones.
#include <chrono>
#include <iomanip>
#include <iostream>
#include <vector>

#include "flow_checks.h"

namespace {

template <typename Rule>
void run_rule(const char* name, long long big, Rule rule) {
    FlowNetwork net = build_network(4, diamond_network(big));
    const auto start = std::chrono::steady_clock::now();
    const FlowRun run = ford_fulkerson(net, 0, 3, rule);
    const std::chrono::duration<double, std::milli> elapsed = std::chrono::steady_clock::now() - start;
    std::cout << std::setw(10) << big << std::setw(26) << name << std::setw(12) << run.value << std::setw(12)
              << run.iterations << std::setw(12) << std::fixed << std::setprecision(1) << elapsed.count() << '\n';
}

}  // namespace

int main() {
    std::cout << "capacidad                     regla       flujo iteraciones          ms\n";
    for (long long big : {10LL, 1000LL, 100000LL, 1000000LL}) {
        run_rule("el más largo", big, longest_path_rule);
        run_rule("primero de un DFS", big, depth_first_rule);
        run_rule("BFS (Edmonds-Karp)", big, shortest_path_rule);
    }
}
