@@ -44,6 +44,9 @@ void initialize_data_log(const std::filesystem::path& data_log_path)
4444 output_file << " step_size," ;
4545 output_file << " energy," ;
4646 output_file << " max_error," ;
47+ output_file << " rmse," ;
48+ output_file << " rrmse," ;
49+ output_file << " rmsre," ;
4750 output_file << " convergence_ratio," ;
4851 output_file << " max_change_in_metric_coords," ;
4952 output_file << " actual_to_unconstrained_direction_ratio," ;
@@ -65,6 +68,19 @@ void update_data_log(
6568 const VectorX& descent_direction,
6669 Scalar convergence_ratio)
6770{
71+ // Get initial metric coordinates
72+ VectorX metric_init = initial_cone_metric.get_reduced_metric_coordinates ();
73+
74+ // Get edge lengths
75+ int num_reduced_edges = metric_init.size ();
76+ VectorX l_init (num_reduced_edges);
77+ VectorX l (num_reduced_edges);
78+ for (int E = 0 ; E < num_reduced_edges; ++E)
79+ {
80+ l_init[E] = exp (metric_init[E] / 2.0 );
81+ l[E] = exp (reduced_metric_coords[E] / 2.0 );
82+ }
83+
6884 // Copy metric and make discrete
6985 std::unique_ptr<DifferentiableConeMetric> cone_metric =
7086 initial_cone_metric.set_metric_coordinates (reduced_metric_coords);
@@ -84,6 +100,9 @@ void update_data_log(
84100 // Compute numerics
85101 log.energy = opt_energy.energy (initial_cone_metric);
86102 log.error = sup_norm (constraint);
103+ log.rmse = root_mean_square_error (l, l_init);
104+ log.rrmse = relative_root_mean_square_error (l, l_init);
105+ log.rmsre = root_mean_square_relative_error (l, l_init);
87106 log.num_flips = cone_metric->num_flips ();
88107 log.convergence_ratio = convergence_ratio;
89108 log.max_change_in_metric_coords = sup_norm (change_in_metric_coords);
@@ -175,6 +194,9 @@ void write_data_log_entry(const OptimizationLog& log, const std::filesystem::pat
175194 output_file << std::fixed << std::setprecision (17 ) << log.beta << " ," ;
176195 output_file << std::fixed << std::setprecision (17 ) << log.energy << " ," ;
177196 output_file << std::fixed << std::setprecision (17 ) << log.error << " ," ;
197+ output_file << std::fixed << std::setprecision (17 ) << log.rmse << " ," ;
198+ output_file << std::fixed << std::setprecision (17 ) << log.rrmse << " ," ;
199+ output_file << std::fixed << std::setprecision (17 ) << log.rmsre << " ," ;
178200 output_file << std::fixed << std::setprecision (17 ) << log.convergence_ratio << " ," ;
179201 output_file << std::fixed << std::setprecision (17 ) << log.max_change_in_metric_coords << " ," ;
180202 output_file << std::fixed << std::setprecision (17 )
0 commit comments