43 #ifndef ILQGAMES_GUI_CONTROL_SLIDERS_H 44 #define ILQGAMES_GUI_CONTROL_SLIDERS_H 46 #include <ilqgames/utils/solver_log.h> 57 std::vector<std::shared_ptr<const ilqgames::SolverLog>>>&
58 logs_for_each_problem)
59 : interpolation_time_(0.0),
63 logs_for_each_problem_(logs_for_each_problem) {
64 for (
const auto& logs : logs_for_each_problem_) {
65 for (
const auto& log : logs) CHECK_NOTNULL(log.get());
69 for (
const auto& logs : logs_for_each_problem_) {
70 if (logs.size() >
static_cast<size_t>(max_log_index_) + 1)
71 max_log_index_ = logs.size() - 1;
79 size_t NumProblems()
const {
return logs_for_each_problem_.size(); }
80 const std::vector<std::vector<std::shared_ptr<const SolverLog>>>&
81 LogsForEachProblem()
const {
82 return logs_for_each_problem_;
84 std::vector<std::shared_ptr<const SolverLog>> LogForEachProblem()
const {
85 std::vector<std::shared_ptr<const SolverLog>> logs(NumProblems());
86 for (
size_t ii = 0; ii < NumProblems(); ii++)
87 logs[ii] = logs_for_each_problem_[ii][LogIndex(ii)];
91 Time InterpolationTime(
size_t problem_idx)
const {
92 CHECK_LT(problem_idx, NumProblems());
94 const auto& logs = logs_for_each_problem_[problem_idx];
95 const int log_idx = LogIndex(problem_idx);
96 return std::max(std::min(static_cast<Time>(interpolation_time_),
97 logs[log_idx]->FinalTime()),
98 logs[log_idx]->InitialTime());
100 int SolverIterate(
size_t problem_idx)
const {
101 CHECK_LT(problem_idx, NumProblems());
103 const auto& logs = logs_for_each_problem_[problem_idx];
104 const int log_idx = LogIndex(problem_idx);
105 return std::min(solver_iterate_,
106 static_cast<int>(logs[log_idx]->NumIterates() - 1));
108 int LogIndex(
size_t problem_idx)
const {
109 CHECK_LT(problem_idx, NumProblems());
111 const auto& logs = logs_for_each_problem_[problem_idx];
112 return std::min(log_index_, static_cast<int>(logs.size() - 1));
114 int MaxLogIndex()
const {
return max_log_index_; }
118 float interpolation_time_;
131 const std::vector<std::vector<std::shared_ptr<const ilqgames::SolverLog>>>
132 logs_for_each_problem_;