00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <sdpcuts.hpp>
00011 #include <tracer.hpp>
00012 #include <misc_util.hpp>
00013
00014 Tracer::Tracer(char *instance_param, int x_vars_param, int X_vars_param, int y_vars_param) {
00015 iter = 0;
00016 x_vars = x_vars_param;
00017 X_vars = X_vars_param;
00018 y_vars = y_vars_param;
00019 tot_vars = x_vars + X_vars + y_vars;
00020
00021 strcpy(instance,instance_param);
00022
00023 fillVector(main__iteration_bound,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00024 fillVector(main__time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00025 fillVector(main__iteration_time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00026 fillVector(main__lp_time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00027 fillVector(main__total_cuts,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00028 fillVector(main__active_cuts,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00029 fillVector(main__added_cuts,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00030 fillVector(main__total_eigendecompositions,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00031 fillVector(main__deleted_cuts,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00032
00033 fillVector(sdpcuts__num_negative_ev,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00034 fillVector(sdpcuts__most_negative_ev,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00035 fillVector(sdpcuts__time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00036 fillVector(sdpcuts__total_cuts,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00037
00038 fillVector(sparsify__time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00039 fillVector(sparsify__total_cuts,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00040 fillVector(sparsify__duplicated_cuts,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00041 fillVector(sparsify__wise_decompositions,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00042
00043 fillVector(orthocut__time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00044 fillVector(orthocut__total_cuts,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00045
00046 fillVector(linquadcuts__time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00047 fillVector(linquadcuts__total_cuts,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00048
00049 fillVector(disjunctivecuts__time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00050 fillVector(disjunctivecuts__total_cuts,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00051
00052 fillVector(heuristics__current_solution,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00053 fillVector(heuristics__best_solution,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00054 fillVector(heuristics__time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00055 fillVector(heuristics__xxT_solution,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00056 fillVector(heuristics__xxT_solution_lp_heuristic_improvement,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00057 fillVector(heuristics__xxT_time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00058 fillVector(heuristics__MNLP_solution,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00059 fillVector(heuristics__MNLP_solution_lp_heuristic_improvement,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00060 fillVector(heuristics__MNLP_time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00061 fillVector(heuristics__GW_solution,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00062 fillVector(heuristics__GW_solution_lp_heuristic_improvement,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00063 fillVector(heuristics__GW_time,TRACE_ITER_SIZE,TRACER_INVALID_ENTRY);
00064
00065 sparsify__nz_populated = false;
00066 sparsify__single_column_sparsity_populated = false;
00067 sparsify__column_pairs_sparsity_populated = false;
00068 sparsify__top20perc_cuts_violation_populated = false;
00069
00070 }
00071
00072 Tracer::~Tracer() {}
00073
00074
00075
00076 void Tracer::newIter(){
00077 iter++;
00078 }
00079 int Tracer::iterations() const{
00080 return iter+1;
00081 }
00082
00083 void Tracer::detailedReport() const{
00084 FILE *detailed_report_file = NULL;
00085 detailed_report_file = fopen(TRACER_DETAILED_REPORT_FILE, "r");
00086 if(detailed_report_file == NULL) {
00087 detailed_report_file = fopen(TRACER_DETAILED_REPORT_FILE, "w");
00088 fprintf(detailed_report_file,"TRACER_VERSION %d\n",VERSION_TRACER);
00089 print_ifdefs(detailed_report_file);
00090
00091 fprintf(detailed_report_file,
00092 "%-15s %12s %12s %8s %12s %12s %8s %8s %8s %8s %8s %1s %8s %12s %12s %8s %1s %12s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %12s %12s %12s %12s %1s %12s %8s %1s %12s %8s %1s %12s %8s %1s %12s %12s %12s %12s %12s %12s %12s %12s %12s %12s %12s %12s\n"
00093 ,"instance"
00094 ,"tot_time"
00095 ,"iter_time"
00096 ,"iter"
00097 ,"bound"
00098 ,"lp_time"
00099 ,"tot_cuts"
00100 ,"act_cuts"
00101 ,"added_cuts"
00102 ,"del_cuts"
00103 ,"eigendec"
00104 ,REPORT_DELIMITER
00105 ,"num_neg_ev"
00106 ,"most_neg_ev"
00107 ,"sdpcuts_time"
00108 ,"sdpcuts_tot_cuts"
00109 ,REPORT_DELIMITER
00110 ,"sparsify_time"
00111 ,"sparsify_tot_cuts"
00112 ,"sparsify_dup_cuts"
00113 ,"sparsify_wise_eigendec"
00114 ,"sparsify_nz_mean"
00115 ,"sparsify_nz_stddev"
00116 ,"sparsify_nz_min"
00117 ,"sparsify_nz_max"
00118 ,"sparsify_single_column_sparsity_mean"
00119 ,"sparsify_single_column_sparsity_stddev"
00120 ,"sparsify_single_column_sparsity_min"
00121 ,"sparsify_single_column_sparsity_max"
00122 ,"sparsify_column_pairs_sparsity_mean"
00123 ,"sparsify_column_pairs_sparsity_stddev"
00124 ,"sparsify_column_pairs_sparsity_min"
00125 ,"sparsify_column_pairs_sparsity_max"
00126 ,"sparsify_top20perc_cuts_violation_mean"
00127 ,"sparsify_top20perc_cuts_violation_stddev"
00128 ,"sparsify_top20perc_cuts_violation_min"
00129 ,"sparsify_top20perc_cuts_violation_max"
00130 ,REPORT_DELIMITER
00131 ,"orthocut_time"
00132 ,"orthocut_tot_cuts"
00133 ,REPORT_DELIMITER
00134 ,"linquadcuts_time"
00135 ,"linquadcuts_tot_cuts"
00136 ,REPORT_DELIMITER
00137 ,"disjunctivecuts_time"
00138 ,"disjunctivecuts_cuts"
00139 ,REPORT_DELIMITER
00140 ,"heuristics_current_solution"
00141 ,"heuristics_best_solution"
00142 ,"heuristics_time"
00143 ,"heuristics_xxT_solution"
00144 ,"heuristics_xxT_solution_lp_heuristic_improvement"
00145 ,"heuristics_xxT_time"
00146 ,"heuristics_MNLP_solution"
00147 ,"heuristics_MNLP_solution_lp_heuristic_improvement"
00148 ,"heuristics_MNLP_time"
00149 ,"heuristics_GW_solution"
00150 ,"heuristics_GW_solution_lp_heuristic_improvement"
00151 ,"heuristics_GW_time");
00152 }
00153 fclose(detailed_report_file);
00154 detailed_report_file = fopen(TRACER_DETAILED_REPORT_FILE, "a");
00155 for (int i=0;i<iterations();i++) {
00156 fprintf(detailed_report_file,"%-15s",instance);
00157 if (populated(main__time))
00158 fprintf(detailed_report_file," %12.4f",main__time[i]);
00159 else
00160 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00161
00162 if (populated(main__iteration_time))
00163 fprintf(detailed_report_file," %12.4f",main__iteration_time[i]);
00164 else
00165 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00166
00167 fprintf(detailed_report_file," %8d",i);
00168
00169 if (populated(main__iteration_bound))
00170 fprintf(detailed_report_file," %12.4f",main__iteration_bound[i]);
00171 else
00172 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00173 if (populated(main__lp_time))
00174 fprintf(detailed_report_file," %12.4f",main__lp_time[i]);
00175 else
00176 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00177 if (populated(main__total_cuts))
00178 fprintf(detailed_report_file," %8d",main__total_cuts[i]);
00179 else
00180 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00181 if (populated(main__active_cuts))
00182 fprintf(detailed_report_file," %8d",main__active_cuts[i]);
00183 else
00184 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00185 if (populated(main__added_cuts))
00186 fprintf(detailed_report_file," %8d",main__added_cuts[i]);
00187 else
00188 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00189 if (populated(main__deleted_cuts))
00190 fprintf(detailed_report_file," %8d",main__deleted_cuts[i]);
00191 else
00192 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00193 if (populated(main__total_eigendecompositions))
00194 fprintf(detailed_report_file," %8d",main__total_eigendecompositions[i]);
00195 else
00196 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00197
00198 fprintf(detailed_report_file," %1s",REPORT_DELIMITER);
00199
00200 if (populated(sdpcuts__num_negative_ev))
00201 fprintf(detailed_report_file," %8d",sdpcuts__num_negative_ev[i]);
00202 else
00203 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00204 if (populated(sdpcuts__most_negative_ev))
00205 fprintf(detailed_report_file," %12.4f",sdpcuts__most_negative_ev[i]);
00206 else
00207 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00208 if(populated(sdpcuts__time))
00209 fprintf(detailed_report_file," %12.4f",sdpcuts__time[i]);
00210 else
00211 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00212 if(populated(sdpcuts__total_cuts))
00213 fprintf(detailed_report_file," %8d",sdpcuts__total_cuts[i]);
00214 else
00215 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00216
00217 fprintf(detailed_report_file," %1s",REPORT_DELIMITER);
00218
00219 if (populated(sparsify__time))
00220 fprintf(detailed_report_file," %12.4f",sparsify__time[i]);
00221 else
00222 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00223 if (populated(sparsify__total_cuts))
00224 fprintf(detailed_report_file," %8d",sparsify__total_cuts[i]);
00225 else
00226 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00227 if (populated(sparsify__duplicated_cuts))
00228 fprintf(detailed_report_file," %8d",sparsify__duplicated_cuts[i]);
00229 else
00230 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00231 if (populated(sparsify__wise_decompositions))
00232 fprintf(detailed_report_file," %8d",sparsify__wise_decompositions[i]);
00233 else
00234 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00235 if (sparsify__nz_populated) {
00236 fprintf(detailed_report_file
00237 ," %8.2f",sparsify__nz_iter_stat[i].mean());
00238 fprintf(detailed_report_file
00239 ," %8.2f",sparsify__nz_iter_stat[i].stdDev());
00240 fprintf(detailed_report_file
00241 ," %8.0f",sparsify__nz_iter_stat[i].min());
00242 fprintf(detailed_report_file
00243 ," %8.0f",sparsify__nz_iter_stat[i].max());
00244 }
00245 else {
00246 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00247 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00248 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00249 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00250 }
00251 if (sparsify__single_column_sparsity_populated) {
00252 fprintf(detailed_report_file
00253 ," %8.2f",sparsify__single_column_sparsity_iter_stat[i].mean());
00254 fprintf(detailed_report_file
00255 ," %8.2f",sparsify__single_column_sparsity_iter_stat[i].stdDev());
00256 fprintf(detailed_report_file
00257 ," %8.0f",sparsify__single_column_sparsity_iter_stat[i].min());
00258 fprintf(detailed_report_file
00259 ," %8.0f",sparsify__single_column_sparsity_iter_stat[i].max());
00260 }
00261 else {
00262 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00263 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00264 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00265 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00266 }
00267 if (sparsify__column_pairs_sparsity_populated) {
00268 fprintf(detailed_report_file
00269 ," %8.2f",sparsify__column_pairs_sparsity_iter_stat[i].mean());
00270 fprintf(detailed_report_file
00271 ," %8.2f",sparsify__column_pairs_sparsity_iter_stat[i].stdDev());
00272 fprintf(detailed_report_file
00273 ," %8.0f",sparsify__column_pairs_sparsity_iter_stat[i].min());
00274 fprintf(detailed_report_file
00275 ," %8.0f",sparsify__column_pairs_sparsity_iter_stat[i].max());
00276 }
00277 else {
00278 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00279 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00280 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00281 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00282 }
00283 if (sparsify__top20perc_cuts_violation_populated) {
00284 fprintf(detailed_report_file
00285 ," %12.4f",sparsify__top20perc_cuts_violation_iter_stat[i].mean());
00286 fprintf(detailed_report_file
00287 ," %12.4f",sparsify__top20perc_cuts_violation_iter_stat[i].stdDev());
00288 fprintf(detailed_report_file
00289 ," %12.4f",sparsify__top20perc_cuts_violation_iter_stat[i].min());
00290 fprintf(detailed_report_file
00291 ," %12.4f",sparsify__top20perc_cuts_violation_iter_stat[i].max());
00292 }
00293 else {
00294 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00295 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00296 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00297 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00298 }
00299
00300 fprintf(detailed_report_file," %1s",REPORT_DELIMITER);
00301
00302 if(populated(orthocut__time))
00303 fprintf(detailed_report_file," %12.4f",orthocut__time[i]);
00304 else
00305 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00306 if(populated(orthocut__total_cuts))
00307 fprintf(detailed_report_file," %8d",orthocut__total_cuts[i]);
00308 else
00309 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00310
00311 fprintf(detailed_report_file," %1s",REPORT_DELIMITER);
00312
00313 if(populated(linquadcuts__time))
00314 fprintf(detailed_report_file," %12.4f",linquadcuts__time[i]);
00315 else
00316 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00317 if(populated(linquadcuts__total_cuts))
00318 fprintf(detailed_report_file," %8d",linquadcuts__total_cuts[i]);
00319 else
00320 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00321
00322 fprintf(detailed_report_file," %1s",REPORT_DELIMITER);
00323
00324 if(populated(disjunctivecuts__time))
00325 fprintf(detailed_report_file," %12.4f",disjunctivecuts__time[i]);
00326 else
00327 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00328 if(populated(disjunctivecuts__total_cuts))
00329 fprintf(detailed_report_file," %8d",disjunctivecuts__total_cuts[i]);
00330 else
00331 fprintf(detailed_report_file," %8s",REPORT_NO_ENTRY);
00332
00333 fprintf(detailed_report_file," %1s",REPORT_DELIMITER);
00334
00335 if (heuristics__current_solution[i] != TRACER_INVALID_ENTRY)
00336 fprintf(detailed_report_file," %12.4f",heuristics__current_solution[i]);
00337 else
00338 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00339 if (heuristics__best_solution[i] != TRACER_INVALID_ENTRY)
00340 fprintf(detailed_report_file," %12.4f",heuristics__best_solution[i]);
00341 else
00342 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00343 if (populated(heuristics__time))
00344 fprintf(detailed_report_file," %12.4f",heuristics__time[i]);
00345 else
00346 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00347 if (heuristics__xxT_solution[i] != TRACER_INVALID_ENTRY)
00348 fprintf(detailed_report_file
00349 ," %12.4f",heuristics__xxT_solution[i]);
00350 else
00351 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00352 if (heuristics__xxT_solution_lp_heuristic_improvement[i] != TRACER_INVALID_ENTRY)
00353 fprintf(detailed_report_file
00354 ," %12.4f",heuristics__xxT_solution_lp_heuristic_improvement[i]);
00355 else
00356 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00357 if (populated(heuristics__xxT_time))
00358 fprintf(detailed_report_file
00359 ," %12.4f",heuristics__xxT_time[i]);
00360 else
00361 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00362 if (heuristics__MNLP_solution[i] != TRACER_INVALID_ENTRY)
00363 fprintf(detailed_report_file
00364 ," %12.4f",heuristics__MNLP_solution[i]);
00365 else
00366 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00367 if (heuristics__MNLP_solution_lp_heuristic_improvement[i] != TRACER_INVALID_ENTRY)
00368 fprintf(detailed_report_file
00369 ," %12.4f",heuristics__MNLP_solution_lp_heuristic_improvement[i]);
00370 else
00371 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00372 if (populated(heuristics__MNLP_time))
00373 fprintf(detailed_report_file
00374 ," %12.4f",heuristics__MNLP_time[i]);
00375 else
00376 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00377 if (heuristics__GW_solution[i] != TRACER_INVALID_ENTRY)
00378 fprintf(detailed_report_file
00379 ," %12.4f",heuristics__GW_solution[i]);
00380 else
00381 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00382 if (heuristics__GW_solution_lp_heuristic_improvement[i] != TRACER_INVALID_ENTRY)
00383 fprintf(detailed_report_file
00384 ," %12.4f",heuristics__GW_solution_lp_heuristic_improvement[i]);
00385 else
00386 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00387 if (populated(heuristics__GW_time))
00388 fprintf(detailed_report_file
00389 ," %12.4f",heuristics__GW_time[i]);
00390 else
00391 fprintf(detailed_report_file," %12s",REPORT_NO_ENTRY);
00392
00393 fprintf(detailed_report_file,"\n");
00394 }
00395 fclose(detailed_report_file);
00396 }
00397
00398
00399
00400
00401
00402 void Tracer::globalReport() const{
00403 int bound_at_iter[14] = {1,2,3,5,10,15,20,30,50,100,200,300,500,1000};
00404 double bound_at_time[17] = {0.5,1,2,3,5,10,15,20,30,60,120,180,300,600,1200,1800,3600};
00405 double bound_interp_at_time[17]= {0.5,1,2,3,5,10,15,20,30,60,120,180,300,600,1200,1800,3600};
00406
00407 int bound_at_iter_entries =
00408 sizeof(bound_at_iter)/sizeof(bound_at_iter[0]);
00409 int bound_at_time_entries =
00410 sizeof(bound_at_time)/sizeof(bound_at_time[0]);
00411 int bound_interp_at_time_entries =
00412 sizeof(bound_interp_at_time)/sizeof(bound_interp_at_time[0]);
00413
00414 FILE *global_report_file = NULL;
00415 global_report_file = fopen(TRACER_GLOBAL_REPORT_FILE, "r");
00416
00417 if(global_report_file == NULL) {
00418 global_report_file = fopen(TRACER_GLOBAL_REPORT_FILE, "w");
00419 fprintf(global_report_file,"TRACER_VERSION %d\n",VERSION_TRACER);
00420 print_ifdefs(global_report_file);
00421
00422 fprintf(global_report_file
00423 ,"%-15s %1s %8s %8s %8s %8s %1s %12s %12s %8s %12s %8s %8s %8s %8s %1s %12s %8s %1s %12s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %12s %12s %12s %12s %1s %12s %8s %1s %12s %8s %1s %12s %8s %1s %12s %12s %8s %8s %12s %8s %8s %12s %8s %8s %12s"
00424 ,"instance"
00425 ,REPORT_DELIMITER
00426 ,"tot_vars"
00427 ,"x_vars"
00428 ,"X_vars"
00429 ,"y_vars"
00430 ,REPORT_DELIMITER
00431 ,"totaltime"
00432 ,"lpsolve_totaltime"
00433 ,"iterations"
00434 ,"bound"
00435 ,"tot_cuts"
00436 ,"generated_cuts"
00437 ,"deleted_cuts"
00438 ,"eigendec"
00439 ,REPORT_DELIMITER
00440 ,"sdpcuts_totaltime"
00441 ,"sdpcuts_tot_cuts"
00442 ,REPORT_DELIMITER
00443 ,"sparsify_totaltime"
00444 ,"sparsify_tot_cuts"
00445 ,"sparsify_dup_cuts"
00446 ,"sparsify_wise_eigendec"
00447 ,"sparsify_nz_mean"
00448 ,"sparsify_nz_stddev"
00449 ,"sparsify_nz_min"
00450 ,"sparsify_nz_max"
00451 ,"sparsify_single_column_sparsity_mean"
00452 ,"sparsify_single_column_sparsity_stddev"
00453 ,"sparsify_single_column_sparsity_min"
00454 ,"sparsify_single_column_sparsity_max"
00455 ,"sparsify_column_pairs_sparsity_mean"
00456 ,"sparsify_column_pairs_sparsity_stddev"
00457 ,"sparsify_column_pairs_sparsity_min"
00458 ,"sparsify_column_pairs_sparsity_max"
00459 ,"sparsify_top20perc_cuts_violation_mean"
00460 ,"sparsify_top20perc_cuts_violation_stddev"
00461 ,"sparsify_top20perc_cuts_violation_min"
00462 ,"sparsify_top20perc_cuts_violation_max"
00463 ,REPORT_DELIMITER
00464 ,"orthocut_totaltime"
00465 ,"orthocut_tot_cuts"
00466 ,REPORT_DELIMITER
00467 ,"linquadcuts_totaltime"
00468 ,"linquadcuts_tot_cuts"
00469 ,REPORT_DELIMITER
00470 ,"disjunctivecuts_totaltime"
00471 ,"disjunctivecuts_tot_cuts"
00472 ,REPORT_DELIMITER
00473 ,"heuristics_best_solution"
00474 ,"heuristics_time"
00475 ,"heuristics_xxT_best"
00476 ,"heuristics_xxT_lp_heuristic_improvements"
00477 ,"heuristics_xxT_time"
00478 ,"heuristics_MNLP_best"
00479 ,"heuristics_MNLP_lp_heuristic_improvements"
00480 ,"heuristics_MNLP_time"
00481 ,"heuristics_GW_best"
00482 ,"heuristics_GW_lp_heuristic_improvements"
00483 ,"heuristics_GW_time"
00484 );
00485
00486 for (int i=0;i<bound_at_iter_entries;i++) {
00487 char string1[20];
00488 char string2[20];
00489 sprintf(string1,"bound@iter%d",bound_at_iter[i]);
00490 sprintf(string2,"time@iter%d",bound_at_iter[i]);
00491 fprintf(global_report_file," %1s %12s %12s"
00492 ,REPORT_DELIMITER
00493 ,string1
00494 ,string2);
00495 }
00496 for (int i=0;i<bound_at_time_entries;i++) {
00497 char string1[20];
00498 char string2[20];
00499 sprintf(string1,"bound@time%.1f",bound_at_time[i]);
00500 sprintf(string2,"time@time%.1f",bound_at_time[i]);
00501 fprintf(global_report_file," %1s %12s %12s"
00502 ,REPORT_DELIMITER
00503 ,string1
00504 ,string2);
00505 }
00506 for (int i=0;i<bound_interp_at_time_entries;i++) {
00507 char string1[20];
00508 sprintf(string1,"bound_interp@time%.1f",bound_interp_at_time[i]);
00509 fprintf(global_report_file," %1s %12s"
00510 ,REPORT_DELIMITER
00511 ,string1);
00512 }
00513 fprintf(global_report_file,"\n");
00514 }
00515
00516 fclose(global_report_file);
00517 global_report_file = fopen(TRACER_GLOBAL_REPORT_FILE, "a");
00518
00519 fprintf(global_report_file,"%-15s",instance);
00520
00521 fprintf(global_report_file," %1s",REPORT_DELIMITER);
00522
00523 fprintf(global_report_file," %8d",tot_vars);
00524 fprintf(global_report_file," %8d",x_vars);
00525 fprintf(global_report_file," %8d",X_vars);
00526 fprintf(global_report_file," %8d",y_vars);
00527
00528 fprintf(global_report_file," %1s",REPORT_DELIMITER);
00529
00530 if (populated(main__iteration_time))
00531 fprintf(global_report_file," %12.4f",main__time[iter]);
00532 else
00533 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00534 if (populated(main__lp_time))
00535 fprintf(global_report_file," %12.4f",main__lp_time_global_stat.sum());
00536 else
00537 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00538 fprintf(global_report_file," %8d",iter);
00539 if (populated(main__iteration_bound))
00540 fprintf(global_report_file," %12.4f",main__iteration_bound[iter]);
00541 else
00542 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00543
00544 if (populated(main__total_cuts))
00545 fprintf(global_report_file," %8d",main__total_cuts[iter]);
00546 else
00547 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00548
00549 if (populated(main__added_cuts))
00550 fprintf(global_report_file," %8.0f",main__added_cuts_global_stat.sum());
00551 else
00552 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00553 if (populated(main__deleted_cuts))
00554 fprintf(global_report_file," %8.0f",main__deleted_cuts_global_stat.sum());
00555 else
00556 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00557 if (populated(main__total_eigendecompositions))
00558 fprintf(global_report_file," %8.0f",main__total_eigendecompositions_global_stat.sum());
00559 else
00560 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00561
00562 fprintf(global_report_file," %1s",REPORT_DELIMITER);
00563
00564 if (populated(sdpcuts__time))
00565 fprintf(global_report_file," %12.4f",sdpcuts__time_global_stat.sum());
00566 else
00567 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00568 if (populated(sdpcuts__total_cuts))
00569 fprintf(global_report_file," %8.0f",sdpcuts__total_cuts_global_stat.sum());
00570 else
00571 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00572
00573 fprintf(global_report_file," %1s",REPORT_DELIMITER);
00574
00575 if (populated(sparsify__time))
00576 fprintf(global_report_file," %12.4f",sparsify__time_global_stat.sum());
00577 else
00578 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00579 if (populated(sparsify__total_cuts))
00580 fprintf(global_report_file
00581 ," %8.0f",sparsify__total_cuts_global_stat.sum());
00582 else
00583 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00584 if (populated(sparsify__duplicated_cuts))
00585 fprintf(global_report_file
00586 ," %8.0f",sparsify__duplicated_cuts_global_stat.sum());
00587 else
00588 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00589 if (populated(sparsify__wise_decompositions))
00590 fprintf(global_report_file
00591 ," %8.0f",sparsify__wise_decompositions_global_stat.sum());
00592 else
00593 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00594
00595 if (sparsify__nz_populated) {
00596 fprintf(global_report_file
00597 ," %8.2f",sparsify__nz_global_stat.mean());
00598 fprintf(global_report_file
00599 ," %8.2f",sparsify__nz_global_stat.stdDev());
00600 fprintf(global_report_file
00601 ," %8.0f",sparsify__nz_global_stat.min());
00602 fprintf(global_report_file
00603 ," %8.0f",sparsify__nz_global_stat.max());
00604 }
00605 else {
00606 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00607 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00608 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00609 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00610 }
00611 if (sparsify__single_column_sparsity_populated) {
00612 fprintf(global_report_file
00613 ," %8.2f",sparsify__single_column_sparsity_global_stat.mean());
00614 fprintf(global_report_file
00615 ," %8.2f",sparsify__single_column_sparsity_global_stat.stdDev());
00616 fprintf(global_report_file
00617 ," %8.0f",sparsify__single_column_sparsity_global_stat.min());
00618 fprintf(global_report_file
00619 ," %8.0f",sparsify__single_column_sparsity_global_stat.max());
00620 }
00621 else {
00622 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00623 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00624 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00625 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00626 }
00627 if (sparsify__column_pairs_sparsity_populated) {
00628 fprintf(global_report_file
00629 ," %8.2f",sparsify__column_pairs_sparsity_global_stat.mean());
00630 fprintf(global_report_file
00631 ," %8.2f",sparsify__column_pairs_sparsity_global_stat.stdDev());
00632 fprintf(global_report_file
00633 ," %8.0f",sparsify__column_pairs_sparsity_global_stat.min());
00634 fprintf(global_report_file
00635 ," %8.0f",sparsify__column_pairs_sparsity_global_stat.max());
00636 }
00637 else {
00638 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00639 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00640 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00641 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00642 }
00643
00644 if (sparsify__top20perc_cuts_violation_populated) {
00645 fprintf(global_report_file
00646 ," %12.4f",sparsify__top20perc_cuts_violation_global_stat.mean());
00647 fprintf(global_report_file
00648 ," %12.4f",sparsify__top20perc_cuts_violation_global_stat.stdDev());
00649 fprintf(global_report_file
00650 ," %12.4f",sparsify__top20perc_cuts_violation_global_stat.min());
00651 fprintf(global_report_file
00652 ," %12.4f",sparsify__top20perc_cuts_violation_global_stat.max());
00653 }
00654 else {
00655 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00656 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00657 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00658 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00659 }
00660
00661 fprintf(global_report_file," %1s",REPORT_DELIMITER);
00662
00663 if (populated(orthocut__time))
00664 fprintf(global_report_file," %12.4f",orthocut__time_global_stat.sum());
00665 else
00666 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00667 if (populated(orthocut__total_cuts))
00668 fprintf(global_report_file," %8.0f",orthocut__total_cuts_global_stat.sum());
00669 else
00670 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00671
00672 fprintf(global_report_file," %1s",REPORT_DELIMITER);
00673
00674 if (populated(linquadcuts__time))
00675 fprintf(global_report_file," %12.4f",linquadcuts__time_global_stat.sum());
00676 else
00677 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00678 if (populated(linquadcuts__total_cuts))
00679 fprintf(global_report_file," %8.0f",linquadcuts__total_cuts_global_stat.sum());
00680 else
00681 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00682
00683 fprintf(global_report_file," %1s",REPORT_DELIMITER);
00684
00685 if (populated(disjunctivecuts__time))
00686 fprintf(global_report_file," %12.4f",disjunctivecuts__time_global_stat.sum());
00687 else
00688 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00689 if (populated(disjunctivecuts__total_cuts))
00690 fprintf(global_report_file," %8.0f",disjunctivecuts__total_cuts_global_stat.sum());
00691 else
00692 fprintf(global_report_file," %8s",REPORT_NO_ENTRY);
00693
00694 fprintf(global_report_file," %1s",REPORT_DELIMITER);
00695
00696 if (heuristics__best_solution[iter] != TRACER_INVALID_ENTRY)
00697 fprintf(global_report_file," %12.4f",heuristics__best_solution[iter]);
00698 else
00699 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00700
00701 if (populated(heuristics__time))
00702 fprintf(global_report_file," %12.4f",heuristics__time_global_stat.sum());
00703 else
00704 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00705
00706 int heuristics_xxT_best_count = 0;
00707 for (int i=0;i<iter;i++)
00708 if ( (heuristics__current_solution[i] != TRACER_INVALID_ENTRY) &&
00709 (heuristics__xxT_solution[i] != TRACER_INVALID_ENTRY) &&
00710 (fabs(heuristics__xxT_solution[i]-heuristics__current_solution[i])
00711 < TRACER_HEURISTICS_COMPARISON_TOLERANCE) )
00712 heuristics_xxT_best_count++;
00713 fprintf(global_report_file
00714 ," %8d",heuristics_xxT_best_count);
00715 fprintf(global_report_file," %8d"
00716 ,heuristics__xxT_solution_lp_heuristic_improvement_global_stat.numNZEntries());
00717
00718 if (populated(heuristics__xxT_time))
00719 fprintf(global_report_file
00720 ," %12.4f"
00721 ,heuristics__xxT_time_global_stat.sum());
00722 else
00723 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00724
00725 int heuristics_MNLP_best_count = 0;
00726 for (int i=0;i<iterations();i++)
00727 if ( (heuristics__current_solution[i] != TRACER_INVALID_ENTRY) &&
00728 (heuristics__MNLP_solution[i] != TRACER_INVALID_ENTRY) &&
00729 (fabs(heuristics__MNLP_solution[i]-heuristics__current_solution[i])
00730 < TRACER_HEURISTICS_COMPARISON_TOLERANCE) )
00731 heuristics_MNLP_best_count++;
00732 fprintf(global_report_file
00733 ," %8d",heuristics_MNLP_best_count);
00734
00735 fprintf(global_report_file," %8d"
00736 ,heuristics__MNLP_solution_lp_heuristic_improvement_global_stat.numNZEntries());
00737
00738 if (populated(heuristics__MNLP_time))
00739 fprintf(global_report_file
00740 ," %12.4f"
00741 ,heuristics__MNLP_time_global_stat.sum());
00742 else
00743 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00744
00745 int heuristics_GW_best_count = 0;
00746 for (int i=0;i<iterations();i++)
00747 if ( (heuristics__current_solution[i] != TRACER_INVALID_ENTRY) &&
00748 (heuristics__GW_solution[i] != TRACER_INVALID_ENTRY) &&
00749 (fabs(heuristics__GW_solution[i]-heuristics__current_solution[i])
00750 < TRACER_HEURISTICS_COMPARISON_TOLERANCE) )
00751 heuristics_GW_best_count++;
00752 fprintf(global_report_file
00753 ," %8d",heuristics_GW_best_count);
00754
00755 fprintf(global_report_file," %8d"
00756 ,heuristics__GW_solution_lp_heuristic_improvement_global_stat.numNZEntries());
00757
00758 if (populated(heuristics__GW_time))
00759 fprintf(global_report_file
00760 ," %12.4f"
00761 ,heuristics__GW_time_global_stat.sum());
00762 else
00763 fprintf(global_report_file," %12s",REPORT_NO_ENTRY);
00764
00765 for (int i=0;i<bound_at_iter_entries;i++) {
00766 bound_struct bs = boundAtIter(bound_at_iter[i]);
00767 if ((bs.bound != TRACER_INVALID_ENTRY) && (bs.time != TRACER_INVALID_ENTRY)) {
00768 fprintf(global_report_file," %1s %12.4f %12.4f"
00769 ,REPORT_DELIMITER
00770 ,bs.bound
00771 ,bs.time);
00772 } else {
00773 fprintf(global_report_file," %1s %12s %12s"
00774 ,REPORT_DELIMITER
00775 ,REPORT_NO_ENTRY
00776 ,REPORT_NO_ENTRY);
00777 }
00778 }
00779 for (int i=0;i<bound_at_time_entries;i++) {
00780 bound_struct bs = boundAtTime(bound_at_time[i]);
00781 if ((bs.bound != TRACER_INVALID_ENTRY) && (bs.time != TRACER_INVALID_ENTRY)) {
00782 fprintf(global_report_file," %1s %12.4f %12.4f"
00783 ,REPORT_DELIMITER
00784 ,bs.bound
00785 ,bs.time);
00786 } else {
00787 fprintf(global_report_file," %1s %12s %12s"
00788 ,REPORT_DELIMITER
00789 ,REPORT_NO_ENTRY
00790 ,REPORT_NO_ENTRY);
00791 }
00792 }
00793 for (int i=0;i<bound_interp_at_time_entries;i++) {
00794 bound_struct bs = boundAtTimeInterpolated(bound_interp_at_time[i]);
00795 if (bs.bound != TRACER_INVALID_ENTRY)
00796 fprintf(global_report_file," %1s %12.4f"
00797 ,REPORT_DELIMITER
00798 ,bs.bound);
00799 else
00800 fprintf(global_report_file," %1s %12s"
00801 ,REPORT_DELIMITER
00802 ,REPORT_NO_ENTRY);
00803 }
00804
00805 fprintf(global_report_file,"\n");
00806 fclose(global_report_file);
00807 }
00808
00809
00810 void Tracer::setMainBound(double value) {
00811 main__iteration_bound[iter] = value;
00812 }
00813 void Tracer::setMainIterationTime(double value) {
00814 main__iteration_time[iter] = value;
00815 if (iter == 0)
00816 main__time[iter] = value;
00817 else
00818 main__time[iter] = value + main__time[iter-1];
00819 }
00820 void Tracer::setMainLPTime(double value) {
00821 main__lp_time[iter] = value;
00822 main__lp_time_global_stat.addEntry(value);
00823 }
00824 void Tracer::setMainActiveCuts(int value) {
00825 main__active_cuts[iter] = value;
00826 main__active_cuts_global_stat.addEntry(value);
00827 }
00828 void Tracer::setMainAddedCuts(int value){
00829 main__added_cuts[iter] = value;
00830 main__added_cuts_global_stat.addEntry(value);
00831 }
00832 void Tracer::setMainTotalCuts(int value){
00833 main__total_cuts[iter] = value;
00834 main__total_cuts_global_stat.addEntry(value);
00835 }
00836 void Tracer::setMainTotalEigendecompositions(int value){
00837 main__total_eigendecompositions[iter] = value;
00838 main__total_eigendecompositions_global_stat.addEntry(value);
00839 }
00840 void Tracer::incrementMainTotalEigendecompositions(){
00841 if (main__total_eigendecompositions[iter] < 0)
00842 main__total_eigendecompositions[iter] = 0;
00843 main__total_eigendecompositions[iter]++;
00844 main__total_eigendecompositions_global_stat.addEntry(1);
00845 }
00846 void Tracer::setMainDeletedCuts(int value){
00847 main__deleted_cuts[iter] = value;
00848 main__deleted_cuts_global_stat.addEntry(value);
00849 }
00850
00851
00852
00853 void Tracer::setSDPNumNegativeEV(int value){
00854 sdpcuts__num_negative_ev[iter] = value;
00855 }
00856 void Tracer::setSDPMostNegativeEV(double value){
00857 sdpcuts__most_negative_ev[iter] = value;
00858 }
00859 void Tracer::setSDPCutsTime(double value) {
00860 sdpcuts__time_global_stat.addEntry(value);
00861 sdpcuts__time[iter] = value;
00862 }
00863
00864 void Tracer::setSDPCutsTotalCuts(int value) {
00865 sdpcuts__total_cuts_global_stat.addEntry(value);
00866 sdpcuts__total_cuts[iter] = value;
00867 }
00868
00869
00870
00871 void Tracer::setSparsifyTime(double value) {
00872 sparsify__time_global_stat.addEntry(value);
00873 sparsify__time[iter] = value;
00874 }
00875 void Tracer::setSparsifyTotalCuts(int value){
00876 sparsify__total_cuts_global_stat.addEntry(value);
00877 sparsify__total_cuts[iter] = value;
00878 }
00879 void Tracer::setSparsifyDuplicatedCuts(int value){
00880 sparsify__duplicated_cuts_global_stat.addEntry(value);
00881 sparsify__duplicated_cuts[iter] = value;
00882 }
00883 void Tracer::setSparsifyWiseDecompositions(int value){
00884 sparsify__wise_decompositions[iter] = value;
00885 sparsify__wise_decompositions_global_stat.addEntry(value);
00886 }
00887 void Tracer::addSparsifyNz(int value){
00888 sparsify__nz_populated = true;
00889 sparsify__nz_iter_stat[iter].addEntry(value);
00890 sparsify__nz_global_stat.addEntry(value);
00891 }
00892 void Tracer::addSparsifySingleColumnSparsity(int value){
00893 sparsify__single_column_sparsity_populated = true;
00894 sparsify__single_column_sparsity_iter_stat[iter].addEntry(value);
00895 sparsify__single_column_sparsity_global_stat.addEntry(value);
00896 }
00897 void Tracer::addSparsifyColumnPairSparsity(int value){
00898 sparsify__column_pairs_sparsity_populated = true;
00899 sparsify__column_pairs_sparsity_iter_stat[iter].addEntry(value);
00900 sparsify__column_pairs_sparsity_global_stat.addEntry(value);
00901 }
00902 void Tracer::addSparsifyTop20PercCutsViolation(double value){
00903 sparsify__top20perc_cuts_violation_populated = true;
00904 sparsify__top20perc_cuts_violation_iter_stat[iter].addEntry(value);
00905 sparsify__top20perc_cuts_violation_global_stat.addEntry(value);
00906 }
00907
00908
00909
00910 void Tracer::setOrthocutTime(double value){
00911 orthocut__time_global_stat.addEntry(value);
00912 orthocut__time[iter] = value;
00913 }
00914 void Tracer::setOrthocutTotalCuts(int value){
00915 orthocut__total_cuts_global_stat.addEntry(value);
00916 orthocut__total_cuts[iter] = value;
00917 }
00918
00919
00920 void Tracer::setLinquadTime(double value){
00921 linquadcuts__time_global_stat.addEntry(value);
00922 linquadcuts__time[iter] = value;
00923 }
00924 void Tracer::setLinquadTotalCuts(int value){
00925 linquadcuts__total_cuts_global_stat.addEntry(value);
00926 linquadcuts__total_cuts[iter] = value;
00927 }
00928
00929
00930 void Tracer::setDisjunctiveCutsTime(double value){
00931 disjunctivecuts__time_global_stat.addEntry(value);
00932 disjunctivecuts__time[iter] = value;
00933 }
00934
00935 void Tracer::setDisjunctiveCutsTotalCuts(int value){
00936 disjunctivecuts__total_cuts_global_stat.addEntry(value);
00937 disjunctivecuts__total_cuts[iter] = value;
00938 }
00939
00940
00941
00942
00943 void Tracer::setHeuristicsCurrentSolution(double value){
00944 heuristics__current_solution[iter] = value;
00945 }
00946 void Tracer::setHeuristicsBestSolution(double value){
00947 heuristics__best_solution[iter] = value;
00948 }
00949 void Tracer::setHeuristicsTime(double value){
00950 heuristics__time[iter] = value;
00951 heuristics__time_global_stat.addEntry(value);
00952 }
00953 void Tracer::setHeuristicsxxTSolution(double value){
00954 heuristics__xxT_solution[iter] = value;
00955 }
00956 void Tracer::setHeuristicsxxTSolutionLPHeuristicImprovement(double value){
00957 heuristics__xxT_solution_lp_heuristic_improvement[iter] = value;
00958 heuristics__xxT_solution_lp_heuristic_improvement_global_stat.addEntry(value);
00959 }
00960 void Tracer::setHeuristicsMNLPSolution(double value){
00961 heuristics__MNLP_solution[iter] = value;
00962 }
00963 void Tracer::setHeuristicsMNLPSolutionLPHeuristicImprovement(double value){
00964 heuristics__MNLP_solution_lp_heuristic_improvement[iter] = value;
00965 heuristics__MNLP_solution_lp_heuristic_improvement_global_stat.addEntry(value);
00966 }
00967 void Tracer::setHeuristicsGWSolution(double value){
00968 heuristics__GW_solution[iter] = value;
00969 }
00970 void Tracer::setHeuristicsGWSolutionLPHeuristicImprovement(double value){
00971 heuristics__GW_solution_lp_heuristic_improvement[iter] = value;
00972 heuristics__GW_solution_lp_heuristic_improvement_global_stat.addEntry(value);
00973 }
00974 void Tracer::setHeuristicsxxTTime(double value){
00975 heuristics__xxT_time[iter] = value;
00976 heuristics__xxT_time_global_stat.addEntry(value);
00977 }
00978 void Tracer::setHeuristicsMNLPTime(double value){
00979 heuristics__MNLP_time[iter] = value;
00980 heuristics__MNLP_time_global_stat.addEntry(value);
00981 }
00982 void Tracer::setHeuristicsGWTime(double value){
00983 heuristics__GW_time[iter] = value;
00984 heuristics__GW_time_global_stat.addEntry(value);
00985 }
00986
00987
00988
00989
00990
00991 bound_struct Tracer::boundAtTime(double time) const {
00992 bound_struct bs;
00993 bs.bound = TRACER_INVALID_ENTRY;
00994 bs.time = TRACER_INVALID_ENTRY;
00995 bs.iter1 = TRACER_INVALID_ENTRY;
00996 bs.iter2 = TRACER_INVALID_ENTRY;
00997
00998 int iter_out = 0;
00999 if (time > main__time[iter]) {
01000 return bs;
01001 }
01002
01003 while (main__time[iter_out]<time) {
01004 iter_out++;
01005 }
01006 bs.bound = main__iteration_bound[iter_out];
01007 bs.time = main__time[iter_out];
01008 bs.iter1 = iter_out;
01009 bs.iter2 = iter_out;
01010
01011 return bs;
01012 }
01013
01014
01015
01016 bound_struct Tracer::boundAtIter(int i) const {
01017 bound_struct bs;
01018 bs.bound = TRACER_INVALID_ENTRY;
01019 bs.time = TRACER_INVALID_ENTRY;
01020 bs.iter1 = TRACER_INVALID_ENTRY;
01021 bs.iter2 = TRACER_INVALID_ENTRY;
01022
01023 int iter_out = 0;
01024 if ( (i < 0) || (i > iterations()-1) ) {
01025 return bs;
01026 }
01027
01028 bs.bound = main__iteration_bound[i];
01029 bs.time = main__time[i];
01030 bs.iter1 = i;
01031 bs.iter2 = i;
01032
01033 return bs;
01034 }
01035
01036 bound_struct Tracer::boundAtTimeInterpolated(double time) const {
01037 bound_struct bs;
01038 bs.bound = TRACER_INVALID_ENTRY;
01039 bs.time = TRACER_INVALID_ENTRY;
01040 bs.iter1 = TRACER_INVALID_ENTRY;
01041 bs.iter2 = TRACER_INVALID_ENTRY;
01042
01043 int iter1 = 0;
01044 int iter2 = iter;
01045 if (time > main__time[iter]) {
01046 return bs;
01047 }
01048 if (time < main__time[0]) {
01049 return bs;
01050 }
01051 while (main__time[iter1]<time) {
01052 iter1++;
01053 }
01054 while (main__time[iter2]>time) {
01055 iter2--;
01056 }
01057
01058
01059
01060 double interpolated_bound = main__iteration_bound[iter1] +
01061 ( (time - main__time[iter1]) *
01062 (main__iteration_bound[iter2] - main__iteration_bound[iter1]) /
01063 (main__time[iter2] - main__time[iter1]) );
01064 bs.bound = interpolated_bound;
01065 bs.time = time;
01066 bs.iter1 = iter1;
01067 bs.iter2 = iter2;
01068 return bs;
01069 }
01070
01071 void Tracer::fillVector(double* vector, int length, double value){
01072 for (int i=0;i<length;i++)
01073 vector[i] = value;
01074 }
01075
01076 void Tracer::fillVector(int* vector, int length, int value){
01077 for (int i=0;i<length;i++)
01078 vector[i] = value;
01079 }
01080
01081 bool Tracer::populated(const int* vector) const {
01082 for (int i=0;i<iterations();i++)
01083 if(vector[i] == TRACER_INVALID_ENTRY)
01084 return false;
01085 return true;
01086 }
01087
01088 bool Tracer::populated(const double* vector) const {
01089 for (int i=0;i<iterations();i++)
01090 if(vector[i] == TRACER_INVALID_ENTRY)
01091 return false;
01092 return true;
01093 }
01094
01095