1 /** @file eval_helper.hpp
2 @package snark14Display
3 @author Bruno M. Carvalho and Deniz Sarioz
4 licensed under (open-source) QPL v1.0
5 which accompanies this distribution in the file QPL
8 /** @name eval_helper.hpp
11 @package snark14Display
15 #ifndef _EVAL_HELPER_HPP
16 #define _EVAL_HELPER_HPP
19 #include "verbosity.hpp"
27 #include "line_real_set_t.hpp"
30 enum globalYVar_t { AVERAGE, DISTANCE, RELERR, VARIANCE, STDDEV, RESIDUAL, KULLBACK };
32 typedef char* measline_t; // these types are potentially used everywhere
33 typedef char* execname_t;
35 class phantomeas; // forward declaration of classes used by eval_execution_set
38 /** "public interface"-like class definition of eval_execution_set:
39 * superstructure capable of holding information
40 * from many eval executions, an entire eval08 file */
41 class eval_execution_set {
42 std::deque<eval_execution> execs; // entire output of snark14 EVALUATE executions
43 std::vector<bool> selected; // holds which execs are selected by snark14Display user
44 phantomeas* phantomeasp;
45 bool completed; // holds whether creation of execs is complete (is this really necessary here?)
46 bool extrema_calculated; // holds whether extrema are calculated (ditto.)
47 bool selectionHasResidualvar;
48 bool selectionHasKullbackvar;
49 bool same_x_forall; // for iter, plotted on x-axis
50 bool same_y_forall; // for whatever it is that is requested for plotting on y-axis
51 // (almost the same as for eval_execution) extrama...
52 // first the global extrema
54 double minAverage, maxAverage, minDistance, maxDistance, minRelerr, maxRelerr;
55 double minVariance, maxVariance, minStddev, maxStddev, minResidual, maxResidual, minKullback, maxKullback;
56 // then the PBP extrema...
57 std::vector<double> PBP_minima; // minima and maxima of each E(0)..E(N-1), N not varying within an eval file.
58 std::vector<double> PBP_maxima; // to be calculated over ALL EVALUATE calls, depending.
59 unsigned num_Es; // 'N' in comment above
60 // e.g., PBP_minima[2] is the minimum value of all E(2) in all PBPmeasets in all execs.
64 // cultivation (call during the eval file reading phase)
65 void new_exec(execname_t line);
66 void new_globmeaset(execname_t line);
67 void add_to_globmeaset(measline_t line);
68 void new_PBPmeaset(execname_t line);
69 void add_to_PBPmeaset(measline_t line);
70 void set_phantomeas(measline_t line);
71 // completion (call to signal transition from cultivation phase to manipulation phase)
74 bool calculate_global_extrema(bool restrict_domain, int min_it_arg, int max_it_arg);
75 bool calculate_global_extrema();
76 bool calculate_PBP_extrema(bool restrict_domain, int min_it_arg, int max_it_arg);
77 bool calculate_PBP_extrema();
78 void deselect_exec(unsigned idx);
79 void select_exec(unsigned idx);
80 void deselect_all_execs();
81 void select_all_execs();
82 void setSameXForAll (bool val = true);
83 void setSameYForAll (bool val = true);
84 void useSameExtremaForAll (bool val = true);
85 void useDifferentExtremaForEach();
86 // information extraction pertaining to entire set
87 unsigned num_eval_execs();
89 bool selectionHasGlobal();
90 bool selectionHasResidual(); // should really be called only after selectionHasGlobal()
91 bool selectionHasKullback();
92 bool selectionHasPBP();
93 unsigned get_num_Es(); // if no PBP, returns 0. should really be called only after hasPBP()
94 bool getSameXForAll();
95 bool getSameYForAll();
96 int getMinIterViaGlobal(); // by some sleight of theory,
97 int getMaxIterViaGlobal(); // iterations could be different from global to PBP...
98 int getMinIterViaPBP(); // I'm taking out insurance.
99 int getMaxIterViaPBP();
100 double getMinYGlobal(globalYVar_t globalYVar);
101 double getMaxYGlobal(globalYVar_t globalYVar);
102 double getMinYPBP(unsigned idx);
103 double getMaxYPBP(unsigned idx);
104 // information extraction pertaining to a single evaluate execution
105 execname_t getExecName(unsigned idx);
106 // reporting to stdout (for debugging)
108 void show_selected();
110 void addPBPVarLines(line_real_set_t& LRS, unsigned PBPYVar, unsigned ee_index);
111 void addGlobVarLines(line_real_set_t& LRS, globalYVar_t globalYVar, unsigned ee_index);
112 void spawnDialogsGlob(QWidget* parent, globalYVar_t globalYVar);
113 void spawnDialogsPBP(QWidget* parent, unsigned PBPYVar);
114 void spawnAllPlotsGlob(QWidget* parent, globalYVar_t globalYVar, int userMinXVal, int userMaxXVal, double userMinYVal, double userMaxYVal, bool isGrayScale);
115 void spawnAllPlotsPBP(QWidget* parent, unsigned PBPYVar, int userMinXVal, int userMaxXVal, double userMinYVal, double userMaxYVal, bool isGrayScale);
116 // two flavors of destruction
117 void clear(); // allows there to be a single, shared variable
118 ~eval_execution_set();
119 }; // --"public interface" (within entire snark14Display) of class eval_execution_set
120 #endif // _EVAL_HELPER_HPP