tracer.hpp

Go to the documentation of this file.
00001 /* $Id: tracer.hpp 508 2011-02-15 21:52:44Z pbelotti $
00002  *
00003  * Name:    tracer.hpp
00004  * Author:  Andrea Qualizza
00005  * Purpose: 
00006  *
00007  * This file is licensed under the Eclipse Public License (EPL)
00008  */
00009 
00010 #ifndef TRACER_HPP
00011 #define TRACER_HPP
00012 #include <misc_util.hpp>
00013 
00014 #define VERSION_TRACER 1
00015 #define REPORT_DELIMITER "|"
00016 #define REPORT_NO_ENTRY "!"
00017 #define TRACER_GLOBAL_REPORT_FILE "globalreport.txt"
00018 #define TRACER_DETAILED_REPORT_FILE "detailedreport.txt"
00019 
00020 #define TRACER_HEURISTICS_COMPARISON_TOLERANCE 1e-8
00021 
00022 #define TRACER_INVALID_ENTRY -999999999
00023 
00024 #define EXIT_ON_ITER 1000
00025 
00026 #define TRACE_ITER_SIZE EXIT_ON_ITER+2
00027 
00028 
00029 typedef struct bs {
00030         double time;
00031         double bound;
00032         int iter1;
00033         int iter2;
00034 } bound_struct;
00035 
00036 class Tracer {
00037 public:
00038         Tracer(char *instance_param, int x_vars_param, int X_vars_param, int y_vars_param);
00039         ~Tracer();
00040 
00041         // control functions
00042         void newIter();
00043         int iterations() const;
00044         void detailedReport() const;
00045         void globalReport() const;
00046 
00047         // functions for main entries
00048         void setMainBound(double value);
00049         void setMainIterationTime(double value);
00050         void setMainLPTime(double value);
00051         void setMainActiveCuts(int value);
00052         void setMainAddedCuts(int value);
00053         void setMainTotalCuts(int value);
00054         void setMainTotalEigendecompositions(int value);
00055         void incrementMainTotalEigendecompositions();
00056         void setMainDeletedCuts(int value);
00057 
00058         // functions for sdp cuts
00059         void setSDPNumNegativeEV(int value);
00060         void setSDPMostNegativeEV(double value);
00061         void setSDPCutsTime(double value);
00062         void setSDPCutsTotalCuts(int value);
00063 
00064 
00065         // functions for sparsify entries
00066         void setSparsifyTime(double value);
00067         void setSparsifyTotalCuts(int value);
00068         void setSparsifyDuplicatedCuts(int value);
00069         void setSparsifyWiseDecompositions(int value);
00070         void addSparsifyNz(int value);
00071         void addSparsifySingleColumnSparsity(int value);
00072         void addSparsifyColumnPairSparsity(int value);
00073         void addSparsifyTop20PercCutsViolation(double value);
00074 
00075 
00076         // functions for orthocut
00077         void setOrthocutTime(double value);
00078         void setOrthocutTotalCuts(int value);
00079 
00080 
00081         // functions for linquad cuts
00082         void setLinquadTime(double value);
00083         void setLinquadTotalCuts(int value);
00084 
00085 
00086         // functions for disjunctive cuts
00087         void setDisjunctiveCutsTime(double value);
00088         void setDisjunctiveCutsTotalCuts(int value);
00089 
00090 
00091         // functions for heuristics entries
00092         void setHeuristicsCurrentSolution(double value);
00093         void setHeuristicsBestSolution(double value);
00094         void setHeuristicsTime(double value);
00095         void setHeuristicsxxTSolution(double value);
00096         void setHeuristicsxxTSolutionLPHeuristicImprovement(double value);
00097         void setHeuristicsxxTTime(double value);
00098         void setHeuristicsMNLPSolution(double value);
00099         void setHeuristicsMNLPSolutionLPHeuristicImprovement(double value);
00100         void setHeuristicsMNLPTime(double value);
00101         void setHeuristicsGWSolution(double value);
00102         void setHeuristicsGWSolutionLPHeuristicImprovement(double value);
00103         void setHeuristicsGWTime(double value);
00104 
00105         int iter;
00106         int x_vars;
00107         int X_vars;
00108         int y_vars;
00109         int tot_vars;
00110 
00111         char instance[200];
00112         
00113         double  main__iteration_bound[TRACE_ITER_SIZE];
00114         double  main__time[TRACE_ITER_SIZE];
00115         double  main__iteration_time[TRACE_ITER_SIZE];
00116         double  main__lp_time[TRACE_ITER_SIZE];
00117         Stat    main__lp_time_global_stat;
00118         int     main__total_cuts[TRACE_ITER_SIZE];
00119         Stat    main__total_cuts_global_stat;
00120         int     main__active_cuts[TRACE_ITER_SIZE];
00121         Stat    main__active_cuts_global_stat;
00122         int     main__added_cuts[TRACE_ITER_SIZE];
00123         Stat    main__added_cuts_global_stat;
00124         int     main__deleted_cuts[TRACE_ITER_SIZE];
00125         Stat    main__deleted_cuts_global_stat;
00126         int     main__total_eigendecompositions[TRACE_ITER_SIZE];
00127         Stat    main__total_eigendecompositions_global_stat; //use only for sum() !!!
00128 
00129         int     sdpcuts__num_negative_ev[TRACE_ITER_SIZE];
00130         double  sdpcuts__most_negative_ev[TRACE_ITER_SIZE];
00131         double  sdpcuts__time[TRACE_ITER_SIZE];
00132         Stat    sdpcuts__time_global_stat;
00133         int     sdpcuts__total_cuts[TRACE_ITER_SIZE];
00134         Stat    sdpcuts__total_cuts_global_stat;
00135 
00136         double  sparsify__time[TRACE_ITER_SIZE];
00137         Stat    sparsify__time_global_stat;
00138         int     sparsify__total_cuts[TRACE_ITER_SIZE];
00139         Stat    sparsify__total_cuts_global_stat;
00140         int     sparsify__duplicated_cuts[TRACE_ITER_SIZE];
00141         Stat    sparsify__duplicated_cuts_global_stat;
00142         int     sparsify__wise_decompositions[TRACE_ITER_SIZE];
00143         Stat    sparsify__wise_decompositions_global_stat;
00144         Stat    sparsify__nz_global_stat;
00145         Stat    sparsify__nz_iter_stat[TRACE_ITER_SIZE];
00146         bool    sparsify__nz_populated;
00147         Stat    sparsify__single_column_sparsity_global_stat;
00148         Stat    sparsify__single_column_sparsity_iter_stat[TRACE_ITER_SIZE];
00149         bool    sparsify__single_column_sparsity_populated;
00150         Stat    sparsify__column_pairs_sparsity_global_stat;
00151         Stat    sparsify__column_pairs_sparsity_iter_stat[TRACE_ITER_SIZE];
00152         bool    sparsify__column_pairs_sparsity_populated;
00153         Stat    sparsify__top20perc_cuts_violation_global_stat;
00154         Stat    sparsify__top20perc_cuts_violation_iter_stat[TRACE_ITER_SIZE];
00155         bool    sparsify__top20perc_cuts_violation_populated;
00156 
00157         int     orthocut__total_cuts[TRACE_ITER_SIZE];
00158         Stat    orthocut__total_cuts_global_stat;
00159         double  orthocut__time[TRACE_ITER_SIZE];
00160         Stat    orthocut__time_global_stat;
00161 
00162         int     linquadcuts__total_cuts[TRACE_ITER_SIZE];
00163         Stat    linquadcuts__total_cuts_global_stat;
00164         double  linquadcuts__time[TRACE_ITER_SIZE];
00165         Stat    linquadcuts__time_global_stat;
00166 
00167         int     disjunctivecuts__total_cuts[TRACE_ITER_SIZE];
00168         Stat    disjunctivecuts__total_cuts_global_stat;
00169         double  disjunctivecuts__time[TRACE_ITER_SIZE];
00170         Stat    disjunctivecuts__time_global_stat;
00171 
00172         double  heuristics__current_solution[TRACE_ITER_SIZE];
00173         double  heuristics__best_solution[TRACE_ITER_SIZE];
00174         double  heuristics__time[TRACE_ITER_SIZE];
00175         Stat    heuristics__time_global_stat;
00176         double  heuristics__xxT_solution[TRACE_ITER_SIZE];
00177         double  heuristics__xxT_solution_lp_heuristic_improvement[TRACE_ITER_SIZE];
00178         Stat    heuristics__xxT_solution_lp_heuristic_improvement_global_stat;
00179         double  heuristics__xxT_time[TRACE_ITER_SIZE];
00180         Stat    heuristics__xxT_time_global_stat;
00181         double  heuristics__MNLP_solution[TRACE_ITER_SIZE];
00182         double  heuristics__MNLP_solution_lp_heuristic_improvement[TRACE_ITER_SIZE];
00183         Stat    heuristics__MNLP_solution_lp_heuristic_improvement_global_stat;
00184         double  heuristics__MNLP_time[TRACE_ITER_SIZE];
00185         Stat    heuristics__MNLP_time_global_stat;
00186         double  heuristics__GW_solution[TRACE_ITER_SIZE];
00187         double  heuristics__GW_solution_lp_heuristic_improvement[TRACE_ITER_SIZE];
00188         Stat    heuristics__GW_solution_lp_heuristic_improvement_global_stat;
00189         double  heuristics__GW_time[TRACE_ITER_SIZE];
00190         Stat    heuristics__GW_time_global_stat;
00191 
00192 private:
00193         bound_struct boundAtTime(double time) const;
00194         bound_struct boundAtIter(int i) const;
00195         bound_struct boundAtTimeInterpolated(double time) const;
00196         void fillVector(double* vector, int length, double value);
00197         void fillVector(int* vector, int length, int value);
00198         bool populated(const double* vector)const ;
00199         bool populated(const int* vector)const ;
00200 };
00201 
00202 
00203 #endif
00204 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 17 Sep 2013 for Couenne by  doxygen 1.6.1