Calculate synchronization accuracy within the chull module
[lttv.git] / lttv / lttv / sync / event_analysis_chull.h
index c96dcae279febd808d05c11baaad8d937f77c792..27dfea2b9e59bcc3626a6963b7341876af56b38e 100644 (file)
@@ -22,6 +22,9 @@
 
 #include "data_structures.h"
 
+#ifdef HAVE_LIBGLPK
+#include <glpk.h>
+#endif
 
 typedef struct
 {
@@ -29,63 +32,12 @@ typedef struct
 } Point;
 
 
-typedef enum
-{
-       EXACT,
-       /* Used for identity factors (a0= 0, a1= 1) that map a trace to itself. In
-        * this case, min, max and accuracy are not initialized.
-        */
-
-       MIDDLE,
-       /* The approximation is the middle of the min and max limits, all fields
-        * are initialized.
-        */
-
-       FALLBACK,
-       /* min and max are not available because the hulls do not respect
-        * assumptions (hulls should not intersect and the upper half-hull should
-        * be below the lower half-hull). The approximation is a "best effort".
-        * All fields are initialized but min and max are NULL.
-        */
-
-       INCOMPLETE,
-       /* min or max is available but not both. The hulls respected assumptions
-        * but all receives took place after all sends or vice versa. approx and
-        * accuracy are not initialized.
-        */
-
-       ABSENT,
-       /* The pair of trace did not have communications in both directions (maybe
-        * even no communication at all). approx and accuracy are not initialized.
-        */
-
-       SCREWED,
-       /* min and max are not available because the algorithms are screwed. One
-        * of min or max (but not both) is NULL. The other is initialized. Approx
-        * is not initialized.
-        */
-
-       APPROX_NB, // This must be the last member
-} ApproxType;
-
-extern const char* const approxNames[APPROX_NB];
-
-typedef struct
-{
-       Factors* min, * max, * approx;
-       ApproxType type;
-       double accuracy;
-} FactorsCHull;
-
-
 typedef struct
 {
        unsigned int dropped;
 
-       /* FactorsCHull allFactors[traceNb][traceNb]
-        *
-        * allFactors is divided into three parts depending on the position of an
-        * element allFactors[i][j]:
+       /* geoFactors is divided into three parts depending on the position of an
+        * element geoFactors->pairFactors[i][j]:
         *   Lower triangular part of the matrix
         *     i > j
         *     This contains the factors between nodes i and j. These factors
@@ -95,9 +47,65 @@ typedef struct
         *     This contains identity factors (a0= 0, a1= 1).
         *   Upper triangular part of the matrix
         *     i < j
-        *     This area is not allocated.
+        *     These factors are absent
+        *
+        * Factor types are used as follows:
+        * EXACT,
+        * Used for identity factors (a0= 0, a1= 1) that map a trace to itself. In
+        * this case, min, max and accuracy are not initialized.
+        *
+        * ACCURATE,
+        * The approximation is the middle of the min and max limits.
+        *
+        * APPROXIMATE,
+        * min and max are not available because the hulls do not respect
+        * assumptions (hulls should not intersect and the upper half-hull should
+        * be below the lower half-hull). The approximation is a "best effort".
+        * All fields are initialized but min and max are NULL.
+        *
+        * INCOMPLETE,
+        * min or max is available but not both. The hulls respected assumptions
+        * but all receives took place after all sends or vice versa.
+        *
+        * ABSENT,
+        * The pair of trace did not have communications in both directions (maybe
+        * even no communication at all). Also used for factors in the upper
+        * triangular matrix.
+        *
+        * FAIL,
+        * min and max are not available because the algorithms are defective. One
+        * of min or max (but not both) is NULL. The other is initialized.
+        */
+       AllFactors* geoFactors;
+
+#ifdef HAVE_LIBGLPK
+       /* Synchronization factors, as calculated via LP, for comparison. Same
+        * structure as geoFactors.
+        *
+        * Factor types are used as follows:
+        * EXACT,
+        * Used for identity factors (a0= 0, a1= 1) that map a trace to itself. In
+        * this case, min, max and accuracy are not initialized.
+        *
+        * ACCURATE,
+        * The approximation is the middle of the min and max limits.
+        *
+        * INCOMPLETE,
+        * min or max is available but not both. The hulls respected assumptions
+        * but all receives took place after all sends or vice versa.
+        *
+        * ABSENT,
+        * The pair of trace did not have communications in both directions (maybe
+        * even no communication at all). Also used when the hulls do not respect
+        * assumptions. Also used for factors in the upper triangular matrix.
         */
-       FactorsCHull** allFactors;
+       AllFactors* lpFactors;
+#endif
+
+       /* This is AnalysisStatsCHull.lpFactors if it is available or else
+        * AnalysisStatsCHull.geoFactors.
+        */
+       AllFactors* allFactors;
 } AnalysisStatsCHull;
 
 
@@ -114,10 +122,16 @@ typedef struct
         */
        FILE*** hullPoints;
 
-       /* FactorsCHull allFactors[traceNb][traceNb]
-        * This is the same array as AnalysisStatsCHull.allFactors.
+       /* This is AnalysisStatsCHull.lpFactors if it is available or else
+        * AnalysisStatsCHull.geoFactors.
+        */
+       AllFactors* allFactors;
+
+#ifdef HAVE_LIBGLPK
+       /* This is the same array as AnalysisStatsCHull.lpFactors.
         */
-       FactorsCHull** allFactors;
+       AllFactors* lpFactors;
+#endif
 } AnalysisGraphsDataCHull;
 
 
@@ -164,17 +178,18 @@ typedef struct
         */
        GQueue*** hullArray;
 
+#ifdef HAVE_LIBGLPK
+       /* glp_prob* lps[traceNum][traceNum]
+        *
+        * Only the lower triangular part of the matrix is allocated, that is
+        * lps[i][j] where i > j */
+       glp_prob*** lps;
+#endif
+
        AnalysisStatsCHull* stats;
        AnalysisGraphsDataCHull* graphsData;
 } AnalysisDataCHull;
 
 void registerAnalysisCHull();
 
-FactorsCHull** calculateAllFactors(struct _SyncState* const syncState);
-void freeAllFactors(const unsigned int traceNb, FactorsCHull** const
-       allFactors);
-
-void calculateFactorsMiddle(FactorsCHull* const factors);
-void destroyFactorsCHull(FactorsCHull* factorsCHull);
-
 #endif
This page took 0.027093 seconds and 4 git commands to generate.