// What the pendulum's solver needs in memory, with and without stored derivatives.
#include <cstdio>

#include "pendulum.h"
#include "trace.h"

int main(int argc, char** argv) {
    Trace trace(argc, argv);
    using Solver = NMPC::Solver<Pendulum>;  // keeps every stage's Jacobians for the iteration
    using CompactSolver = NMPC::Solver<Pendulum, Pendulum::Stages, NMPC::Jacobians::PerStage>;

    std::printf("                      stored Jacobians   made per stage\n");
    std::printf("workspace             %10zu bytes %10zu bytes\n", sizeof(Solver::Workspace), sizeof(CompactSolver::Workspace));
    std::printf("solver object         %10zu bytes %10zu bytes\n", sizeof(Solver), sizeof(CompactSolver));
    trace.value("workspace", double(sizeof(Solver::Workspace)));
    trace.value("workspace_compact", double(sizeof(CompactSolver::Workspace)));
    trace.value("solver", double(sizeof(Solver)));
    return 0;
}
