Skip to content

Commit

Permalink
Added header to output
Browse files Browse the repository at this point in the history
  • Loading branch information
wcaarls committed Dec 4, 2024
1 parent 1318239 commit 9fda6a5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion base/src/experiments/online_learning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ LargeVector OnlineLearningExperiment::run()
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
double duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count()/1000000.;

// If this is the first line, print header
if (tt == 0)
{
std::ostringstream header_oss;
header_oss << std::setw(15) << "Trial" << std::setw(15) << "Steps" << std::setw(15) << "Episode reward" << std::setw(15) << "Episode time" << std::setw(15) << "Reward/s" << std::setw(15) << "Wall time";
INFO(header_oss.str());
}

if (test_interval_ >= 0)
{
if (test)
Expand All @@ -244,7 +252,7 @@ LargeVector OnlineLearningExperiment::run()
else
{
std::ostringstream oss;
oss << std::setw(15) << tt << std::setw(15) << ss << std::setw(15) << std::setprecision(3) << std::fixed << total_reward << std::setw(15) << std::setprecision(3) << total_time << std::setw(15) << std::setprecision(3) << duration;
oss << std::setw(15) << tt << std::setw(15) << ss << std::setw(15) << std::setprecision(3) << std::fixed << total_reward << std::setw(15) << std::setprecision(3) << total_time << std::setw(15) << std::setprecision(3) << total_reward/total_time << std::setw(15) << std::setprecision(3) << duration;
agent_->report(oss);
environment_->report(oss);

Expand Down

0 comments on commit 9fda6a5

Please sign in to comment.