Tuple set maximisers

Haskell commentary on the implementation of Tractable and Practicable Inducers/Haskell Implementation/Tuple set maximisers

Sections

Limited-underlying tuple set list maximiser

Limited-underlying tuple set list builder

No-sum-layer limited-underlying tuple set list builder

Multi-effective no-sum-layer limited-underlying tuple set list builder

Level limited-underlying tuple set list maximiser

Level limited-underlying tuple set list builder

Level no-sum-layer limited-underlying tuple set list builder

Level multi-effective no-sum-layer limited-underlying tuple set list builder

Limited-underlying tuple set list maximiser

The cardinality of the set of next limited-underlying limited-breadth tuple sets, $|\{B : B \subseteq \{K : K \in \mathrm{tuples}(V_A,F),~|K^{\mathrm{C}}| \leq \mathrm{xmax}\},~1 \leq |B| \leq \mathrm{bmax}\}|$, can be addressed by (i) constructing only a single content alignment optimised next limited-underlying limited-breadth layer tuple set $B_{\mathrm{B}} \subseteq \{K : K \in \mathrm{tuples}(V_A,F),~|K^{\mathrm{C}}| \leq \mathrm{xmax}\}$, and (ii) constructing the tuples of that tuple set, $B_{\mathrm{B}}$, one variable at a time. The tuple set, $B_{\mathrm{B}}$, consists of the maximum breadth, $\mathrm{bmax}$, per maximum tuple derived dimension, $\mathrm{mmax}$, top-most tuples, $|B_{\mathrm{B}}| = \lfloor\mathrm{bmax}/\mathrm{mmax}\rfloor$, if the tuples are uniquely aligned, so that the cardinality of derived variables in the layer optimised by applying the contracted decrementing linear non-overlapping fuds list maximiser, $Z_{P,A,A_R,F,\mathrm{n},-,K}$, to each tuple, $K \in B_{\mathrm{B}}$, is no greater than the maximum breadth, $\mathrm{bmax}$. Define the limited-underlying tuple set list maximiser \[ Z_{P,A,A_R,F,\mathrm{B}} = \mathrm{maximiseLister}(X_{P,A,A_R,F,\mathrm{B}},P_{P,A,A_R,F,\mathrm{B}},\mathrm{top}(\mathrm{omax}),R_{P,A,A_R,F,\mathrm{B}}) \] where the optimiser function is \[ \begin{eqnarray} &&X_{P,A,A_R,F,\mathrm{B}} = \\ &&\hspace{2em}\{(K,I_{\mathrm{a}}^{ * }(\mathrm{apply}(V_A,K,\mathrm{his}(F),A))-I_{\mathrm{a}}^{ * }(\mathrm{apply}(V_A,K,\mathrm{his}(F),A_R))) :\\ &&\hspace{20em}K \in \mathrm{tuples}(V_A,F)\} \end{eqnarray} \] where $\mathrm{his} = \mathrm{histograms} \in \mathcal{F} \to \mathrm{P}(\mathcal{A})$ and $\mathrm{apply} \in \mathrm{P}(\mathcal{V}) \times \mathrm{P}(\mathcal{V}) \times \mathrm{P}(\mathcal{A}) \times \mathcal{A} \to \mathcal{A}$.

The neighbourhood function is (Text) \[ \begin{eqnarray} &&P_{P,A,A_R,F,\mathrm{B}}(B) = \{(J,X_{P,A,A_R,F,\mathrm{B}}(J)) : \\ &&\hspace{2em}(K,\cdot) \in B,~w \in \mathrm{vars}(F) \cup V_A \setminus K,~J = K \cup \{w\},~|J^{\mathrm{C}}| \leq \mathrm{xmax}\} \end{eqnarray} \] The neighbourhood function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesFudsFunctionNeighbourhoodTuple :: 
  Integer -> System -> Histogram -> Histogram -> Fud -> Map.Map (Set.Set Variable) Double -> 
  Maybe (Map.Map (Set.Set Variable) Double)

as

parametersSystemsSamplesShufflesFudsFunctionNeighbourhoodTuple xmax uu aa aarr ff bb
  ...
  | ... = Just $ llmm 
      [(jj, algn (apply vv jj xx aa) - algn (apply vv jj xx aarr)) |
        kk <- keys bb, w <- qqll (qq `minus` kk),  
        let jj = kk `add` w, vol uu jj <= xmax]
  | otherwise = Nothing
  where
    vv = vars aa
    qq = vv `cup` fvars ff
    xx = fhis ff
    ...

The initial subset is (Text) \[ \begin{eqnarray} R_{P,A,A_R,\emptyset,\mathrm{B}} &=& \{(\{w,u\},X_{P,A,A_R,\emptyset,\mathrm{B}}(\{w,u\})) : \\ &&\hspace{1em}w,u \in V_A,~u \neq w,~|\{w,u\}^{\mathrm{C}}| \leq \mathrm{xmax}\} \\ R_{P,A,A_R,F,\mathrm{B}} &=& \{(\{w,u\},X_{P,A,A_R,F,\mathrm{B}}(\{w,u\})) : \\ &&\hspace{1em}w \in \mathrm{der}(F),~u \in \mathrm{vars}(F) \cup V_A ,~u \neq w,~|\{w,u\}^{\mathrm{C}}| \leq \mathrm{xmax}\} \end{eqnarray} \] The initial function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesFudsFunctionInitialTuple :: 
  Integer -> System -> Histogram -> Histogram -> Fud -> Maybe (Map.Map (Set.Set Variable) Double)

as

parametersSystemsSamplesShufflesFudsFunctionInitialTuple xmax uu aa aarr ff
  ...
  | ... = Just $ llmm 
      [(kk, algn (apply vv kk xx aa) - algn (apply vv kk xx aarr)) |
        w <- qqll (if ff /= fudEmpty then ww else qq), u <- qqll qq, u /= w, 
        let kk = llqq [w,u], vol uu kk <= xmax]
  | otherwise = Nothing
  where
    ww = fder ff
    vv = vars aa
    qq = vv `cup` fvars ff
    xx = fhis ff
    ...

Then the shuffle content alignment optimised next limited-underlying limited-breadth layer tuple set, $B_{\mathrm{B}}$, is (Text) \[ \begin{eqnarray} &&B_{\mathrm{B}} = \mathrm{topd}(\lfloor\mathrm{bmax}/\mathrm{mmax}\rfloor)(\mathrm{elements}(Z_{P,A,A_R,F,\mathrm{B}})) \in \\ &&\hspace{5em}\{B : B \subseteq \{K : K \in \mathrm{tuples}(V_A,F),~|K^{\mathrm{C}}| \leq \mathrm{xmax}\}\} \end{eqnarray} \] The optimiser function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple :: 
  Integer -> Integer -> System -> Histogram -> Histogram -> Fud ->  
  Maybe [(Map.Map (Set.Set Variable) Double, Map.Map (Set.Set Variable) Double)]

as

parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple xmax omax uu aa aarr ff
  ...
  | ... = Just $
      opt (zzcstupneigh xmax uu aa aarr ff) (topff omax ff) (zzcstupinit xmax uu aa aarr ff)
  | otherwise = Nothing
  where
    opt pp ii rr = let qq = ii rr in (qq, rr) : ls qq
      where
        ls yy = if isempty yy then [] else let nn = pp yy; qq = ii nn in (qq, nn) : ls qq
    zzcstupinit xmax uu aa aarr ff =  fromJust $
      parametersSystemsSamplesShufflesFudsFunctionInitialTuple xmax uu aa aarr ff
    zzcstupneigh xmax uu aa aarr ff bb = fromJust $
      parametersSystemsSamplesShufflesFudsFunctionNeighbourhoodTuple xmax uu aa aarr ff bb
    ...
    topff amax ff mm = llmm $ flipff $ take (fromInteger amax) $ sortdescff ff $ mmll mm
    flipff = map (\((a,_),b) -> (b,a))
    sortdescff ff ll = reverse $ sort $ map (\(kk,a) -> ((a,-(sumlayer ff kk)),kk)) ll 
    sumlayer ff kk = sum [layer ff (sgl w) | w <- qqll kk]
    ...

This implementation of the tuple set list maximiser, $Z_{P,A,A_R,F,\mathrm{B}}$, guarantees no more than $\mathrm{omax}$ tuples at each step of the optimiser list, $\forall B \in \mathrm{set}(\mathrm{list}(Z_{P,A,A_R,F,\mathrm{B}}))~(|B| \leq \mathrm{omax})$, by ordering the tuples first by ascending alignment, $X_{P,A,A_R,F,\mathrm{B}}(K)$, then by descending sum derived variables layer, $-\mathrm{sumlayer}(F,K)$, where $\mathrm{sumlayer} \in \mathcal{F} \times \mathrm{P}(\mathcal{V}) \to \mathbf{N}$ is defined as \[ \mathrm{sumlayer}(F,K) := \sum_{w \in K} \mathrm{layer}(F,\{w\}) \] After $\mathrm{sumlayer}$ the sort is arbitrary in this implementation.

An upper bound on the expected cardinality of the searched may be computed given the maximum underlying dimension, $\mathrm{kmax}$. The upper bound on the expected cardinality in the first layer, $F = \emptyset$, is \[ \sum_{k \in \{2 \ldots \mathrm{min}(\mathrm{kmax},n)\}} \binom{n}{k} \] where $n = |V_A|$ and $\mathrm{min}=\mathrm{minimum}$. In subsequent layers, $F \neq \emptyset$, the upper bound on the expected cardinality is \[ \sum_{k \in \{2 \ldots \mathrm{min}(\mathrm{kmax},q)\}} \binom{q}{k} - \binom{q-x}{k} \] where $W = \mathrm{vars}(F) \cup V_A$, $q = |W|$, $X = \mathrm{der}(F)$ and $x = |X|$.

The maximum underlying dimension, $\mathrm{kmax}$, may be approximated from the geometric average valency $d = |W^{\mathrm{C}}|^{1/q}$, and the maximum underlying volume, $\mathrm{xmax}$, \[ \mathrm{kmax} = \left\lceil\frac{\ln \mathrm{xmax}}{\ln d}\right\rceil \]

The cardinality function is defined in module AlignmentPracticable,

parametersSetVariablesFudsFunctionOptimiserTupleCardinalityUpper :: 
  Integer -> Set.Set Variable -> Fud -> Integer

as

parametersSetVariablesFudsFunctionOptimiserTupleCardinalityUpper kmax vv ff =
    sum [binom q i - binom (q-x) i | i <- [2.. min kmax q]]
  where
    x = toInteger $ Set.size $ if ff == fudEmpty then vv else fder ff
    q = toInteger $ Set.size $ fvars ff `cup` vv
    ...

If it is the case that the $\mathrm{topd}(\mathrm{omax})$ optimisation is such that each step of the list has no more than $\mathrm{omax}$ tuples, then in the first layer, $F = \emptyset$, the cardinality of the searched set is constrained \[ |\mathrm{searched}(Z_{P,A,A_R,F,\mathrm{B}})| \leq n^2 + (\mathrm{kmax}-2) \times \mathrm{omax} \times n \] In subsequent layers, $F \neq \emptyset$, the cardinality of the searched set is constrained \[ |\mathrm{searched}(Z_{P,A,A_R,F,\mathrm{B}})| \leq xq + (\mathrm{kmax}-2) \times \mathrm{omax} \times q \]

For example,

let zzcstupoptcdu aa kmax = parametersSetVariablesFudsFunctionOptimiserTupleCardinalityUpper kmax (vars aa) fudEmpty 

let zzcstupinit aa rr xmax = fromJust $ parametersSystemsSamplesShufflesFudsFunctionInitialTuple xmax (sys aa) aa rr fudEmpty

let zzcstupneigh aa rr kk a xmax = fromJust $ parametersSystemsSamplesShufflesFudsFunctionNeighbourhoodTuple xmax (sys aa) aa rr fudEmpty (Map.singleton kk a)

let zzcstupopt aa rr xmax omax = fromJust $ parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple xmax omax (sys aa) aa rr fudEmpty


let aa = resize 100 $ regcart 3 3

let n = Set.size (vars aa)

n * (n-1) `div` 2
3

rpln $ Map.toList $ zzcstupinit aa (ind aa) (3^2)
"({1,2},0.0)"
"({1,3},0.0)"
"({2,3},0.0)"


let aa = resize 100 $ regpivot 3 3

rpln $ Map.toList $ zzcstupinit aa (ind aa) (3^2)
"({1,2},29.219595563072602)"
"({1,3},29.219595563072602)"
"({2,3},29.219595563072602)"

let aa = resize 200 $ regpivot 3 2 `mul` regtranspose [3,4] (regpivot 3 2) `mul` regtranspose [5,6] (regpivot 3 2)

let n = Set.size (vars aa)

n * (n-1) `div` 2
15

Map.size $ zzcstupinit aa (ind aa) (3^2)
15

rpln $ Map.toList $ zzcstupinit aa (ind aa) (3^2)
"({1,2},92.07931743177642)"
"({1,3},0.0)"
"({1,4},0.0)"
"({1,5},0.0)"
"({1,6},0.0)"
"({2,3},0.0)"
"({2,4},0.0)"
"({2,5},0.0)"
"({2,6},0.0)"
"({3,4},92.07931743177642)"
"({3,5},0.0)"
"({3,6},0.0)"
"({4,5},0.0)"
"({4,6},0.0)"
"({5,6},92.07931743177642)"


let aa = resize 200 $ regpivot 3 2 `mul` regtranspose [3,4] (regcart 3 2)

let n = Set.size (vars aa)

n * (n-1) `div` 2
6

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)
"(0,(0.0,{1,3}))"
"(1,(0.0,{1,4}))"
"(2,(0.0,{2,3}))"
"(3,(0.0,{2,4}))"
"(4,(0.0,{3,4}))"
"(5,(92.07931743177642,{1,2}))"

let (a,kk) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)) !! 5

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)
"(0,(82.48178289336943,{1,2,3}))"
"(1,(82.48178289336943,{1,2,4}))"

let (a,kk) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)) !! 0

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)
"(0,(0.0,{1,3,4}))"
"(1,(82.48178289336943,{1,2,3}))"


let aa = resize 200 $ regpivot 3 2 `mul` regtranspose [3,4] (regaxial 3 2)

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)
"(0,(0.0,{1,3}))"
"(1,(0.0,{1,4}))"
"(2,(0.0,{2,3}))"
"(3,(0.0,{2,4}))"
"(4,(51.067479846592505,{3,4}))"
"(5,(92.07931743177642,{1,2}))"

let (a,kk) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)) !! 5

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)
"(0,(83.2674913127442,{1,2,3}))"
"(1,(83.2674913127442,{1,2,4}))"

let (a,kk) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)) !! 4

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)
"(0,(43.32429360854661,{1,3,4}))"
"(1,(43.32429360854661,{2,3,4}))"

let (a,kk) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)) !! 0

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)
"(0,(43.32429360854661,{1,3,4}))"
"(1,(83.2674913127442,{1,2,3}))"


let (a,kk) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)) !! 5

let (b,jj) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)) !! 1

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) jj b (3^4)
"(0,(106.7740367472689,{1,2,3,4}))"


let (a,kk) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)) !! 4

let (b,jj) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)) !! 1

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) jj b (3^4)
"(0,(106.7740367472689,{1,2,3,4}))"


let (a,kk) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)) !! 0

let (b,jj) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)) !! 1

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) jj b (3^4)
"(0,(106.7740367472689,{1,2,3,4}))"


let (a,kk) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)) !! 0

let (b,jj) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)) !! 0

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) jj b (3^4)
"(0,(106.7740367472689,{1,2,3,4}))"


let aa = resize 100 $ regpivot 3 3

zzcstupoptcdu aa 3
4

rpln $ zip [0.. ] $ fst $ unzip $ zzcstupopt aa (ind aa) (3^3) 100
"(0,{({1,2},29.219595563072602),({1,3},29.219595563072602),({2,3},29.219595563072602)})"
"(1,{({1,2,3},51.72103823613418)})"
"(2,{})"


let aa = resize 200 $ regpivot 3 2 `mul` regtranspose [3,4] (regaxial 3 2)

zzcstupoptcdu aa 4
11

length $ concat $ map Map.toList $ snd $ unzip $ zzcstupopt aa (ind aa) (3^4) 100
11

rpln $ zip [0.. ] $ fst $ unzip $ zzcstupopt aa (ind aa) (3^4) 100
"(0,{({1,2},92.07931743177642),({1,3},0.0),({1,4},0.0),({2,3},0.0),({2,4},0.0),({3,4},51.067479846592505)})"
"(1,{({1,2,3},83.2674913127442),({1,2,4},83.2674913127442),({1,3,4},43.32429360854661),({2,3,4},43.32429360854661)})"
"(2,{({1,2,3,4},106.7740367472689)})"
"(3,{})"

length $ concat $ map Map.toList $ snd $ unzip $ zzcstupopt aa (ind aa) (3^3) 100
10

rpln $ zip [0.. ] $ fst $ unzip $ zzcstupopt aa (ind aa) (3^3) 100
"(0,{({1,2},92.07931743177642),({1,3},0.0),({1,4},0.0),({2,3},0.0),({2,4},0.0),({3,4},51.067479846592505)})"
"(1,{({1,2,3},83.2674913127442),({1,2,4},83.2674913127442),({1,3,4},43.32429360854661),({2,3,4},43.32429360854661)})"
"(2,{})"

rpln $ zip [0.. ] $ fst $ unzip $ zzcstupopt aa (ind aa) (3^3) 1
"(0,{({1,2},92.07931743177642)})"
"(1,{({1,2,4},83.2674913127442)})"
"(2,{})"

rpln $ zip [0.. ] $ fst $ unzip $ zzcstupopt aa (ind aa) (3^2) 100
"(0,{({1,2},92.07931743177642),({1,3},0.0),({1,4},0.0),({2,3},0.0),({2,4},0.0),({3,4},51.067479846592505)})"
"(1,{})"

In the weather forecast example (summarised in Functional definition sets),

let aa = hhaa hh

let zzcstupinit aa rr xmax = fromJust $ parametersSystemsSamplesShufflesFudsFunctionInitialTuple xmax (sys aa) aa rr fudEmpty

let zzcstupneigh aa rr kk a xmax = fromJust $ parametersSystemsSamplesShufflesFudsFunctionNeighbourhoodTuple xmax (sys aa) aa rr fudEmpty (Map.singleton kk a)

let zzcstupopt aa rr xmax omax = fromJust $ parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple xmax omax (sys aa) aa rr fudEmpty


rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)
"(0,(0.646716955827781,{pressure,wind}))"
"(1,(2.7673349953974995,{cloud,wind}))"
"(2,(3.9301313052733455,{rain,wind}))"
"(3,(4.27876667992199,{pressure,rain}))"
"(4,(4.623278490123701,{cloud,pressure}))"
"(5,(6.415037968300277,{cloud,rain}))"

let (a,kk) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupinit aa (ind aa) (3^2)) !! 5

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)
"(0,(8.93504831268134,{cloud,rain,wind}))"
"(1,(11.080279459311331,{cloud,pressure,rain}))"

let (b,jj) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) kk a (3^3)) !! 1

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcstupneigh aa (ind aa) jj b (3^4)
"(0,(11.850852273417695,{cloud,pressure,rain,wind}))"


rpln $ zip [0.. ] $ fst $ unzip $ zzcstupopt aa (ind aa) (3^4) 100
"(0,{({cloud,pressure},4.623278490123701),({cloud,rain},6.415037968300277),({cloud,wind},2.7673349953974995),({pressure,rain},4.27876667992199),({pressure,wind},0.646716955827781),({rain,wind},3.9301313052733455)})"
"(1,{({cloud,pressure,rain},11.080279459311331),({cloud,pressure,wind},6.450141660281459),({cloud,rain,wind},8.93504831268134),({pressure,rain,wind},8.084547184331688)})"
"(2,{({cloud,pressure,rain,wind},11.850852273417695)})"
"(3,{})"

rpln $ zip [0.. ] $ fst $ unzip $ zzcstupopt aa (ind aa) (3^4) 1
"(0,{({cloud,rain},6.415037968300277)})"
"(1,{({cloud,pressure,rain},11.080279459311331)})"
"(2,{({cloud,pressure,rain,wind},11.850852273417695)})"
"(3,{})"

rpln $ zip [0.. ] $ fst $ unzip $ zzcstupopt aa (ind aa) (3^3) 100
"(0,{({cloud,pressure},4.623278490123701),({cloud,rain},6.415037968300277),({cloud,wind},2.7673349953974995),({pressure,rain},4.27876667992199),({pressure,wind},0.646716955827781),({rain,wind},3.9301313052733455)})"
"(1,{({cloud,pressure,rain},11.080279459311331),({cloud,pressure,wind},6.450141660281459),({cloud,rain,wind},8.93504831268134),({pressure,rain,wind},8.084547184331688)})"
"(2,{})"

rpln $ zip [0.. ] $ fst $ unzip $ zzcstupopt aa (ind aa) (3^3) 1
"(0,{({cloud,rain},6.415037968300277)})"
"(1,{({cloud,pressure,rain},11.080279459311331)})"
"(2,{})"

The weather forecast example continues in Limited-layer limited-underlying limited-breadth fud tree searcher.

Limited-underlying tuple set list builder

In order to implement the limited-underlying tuple set list maximiser, $Z_{P,A,A_R,F,\mathrm{B}}$, (Haskell) define the limited-underlying tuple set list builder $I_{P,U,\mathrm{B}} \in \mathrm{computers}$ such that (i) the domain is $\mathrm{domain}(I_{P,U,\mathrm{B}}) = \mathrm{P}(\mathcal{V}_U) \times \mathcal{F}_{U,1} \times \mathcal{A}_U \times \mathcal{A}_U$, (ii) the range is $\mathrm{range}(I_{P,U,\mathrm{B}}) = \mathrm{P}(\mathcal{V}_U) \times \mathcal{A}_U \times \mathcal{A}_U \to \mathbf{Q}$, and (iii) the application is (Text) \[ \begin{eqnarray} I_{P,U,\mathrm{B}}^{ * }((V,\emptyset,X,X_R)) &=& \mathrm{topd}(\lfloor\mathrm{bmax}/\mathrm{mmax}\rfloor)(\mathrm{buildb}(V,X,X_R,\mathrm{init}(V),\emptyset))\\ I_{P,U,\mathrm{B}}^{ * }((V,F,X,X_R)) &=& \mathrm{topd}(\lfloor\mathrm{bmax}/\mathrm{mmax}\rfloor)(\mathrm{buildb}(\mathrm{vars}(F) \cup V,X,X_R,\\ &&\hspace{10em}\mathrm{init}(\mathrm{der}(F)),\emptyset)) \end{eqnarray} \] where $\mathrm{init}(V) := \{(((\{w\},\emptyset,\emptyset),0),0) : w \in V\}$, $\mathrm{buildt} = ((\mathrm{P}(\mathcal{V}_U) \times \mathcal{A}_U \times \mathcal{A}_U) \times \mathbf{Q}) \times (\mathbf{Q} \times \mathbf{N} \times \mathbf{Q} \times \mathbf{N} \times \mathbf{N})$ and $\mathrm{buildb} \in \mathrm{P}(\mathcal{V}_U) \times \mathcal{A}_U \times \mathcal{A}_U \times \mathrm{buildt} \times \mathrm{buildt} \to \mathrm{buildt}$ is defined \[ \begin{eqnarray} &&\mathrm{buildb}(W,X,X_R,Q,N) = \\ &&\hspace{1em}\mathrm{if}(M \neq \emptyset, \mathrm{buildb}(W,X,X_R,M,N \cup M), \mathrm{final}(N)) : \\ &&\hspace{2em}P = \{J : (((K,\cdot,\cdot),\cdot),\cdot) \in Q,~w \in W \setminus K,~J = K \cup \{w\}\}, \\ &&\hspace{2em}M = \mathrm{top}(\mathrm{omax})(\{(((J,B,B_R),a_1-b_1), \\ &&\hspace{8em}(a_1-a_2-b_1+b_2,~-l,~-b_1+b_2,~-u,~D_{\mathcal{X}}(J))) :\\ &&\hspace{4em}J \in P,~u = |J^{\mathrm{C}}|,~u \leq \mathrm{xmax},~l = \mathrm{sumlayer}(F,J),\\ &&\hspace{4em}B = I_{\%}^{ * }((J,X)),~B_R = I_{\%}^{ * }((J,X_R)),\\ &&\hspace{4em}a_1 = I_{\mathrm{\mathrm{S}\approx\mathrm{ln}!}}^{ * }(B),~a_2 = I_{\mathrm{\mathrm{S}\approx\mathrm{ln}!}}^{ * }(I_{\mathrm{X}}^{ * }(B)),\\ &&\hspace{4em}b_1 = I_{\mathrm{\mathrm{S}\approx\mathrm{ln}!}}^{ * }(B_R),~b_2 = I_{\mathrm{\mathrm{S}\approx\mathrm{ln}!}}^{ * }(I_{\mathrm{X}}^{ * }(B_R))\}) \end{eqnarray} \] where $\mathrm{final}(N) := \{(((K,A,B),y),a) : (((K,A,B),y),a) \in N,~|K|>1\}$, $D_{\mathcal{X}} \in \mathrm{enums}(\mathcal{X})$ is an arbitrary order, $\mathrm{sumlayer} \in \mathcal{F} \times \mathrm{P}(\mathcal{V}) \to \mathbf{N}$, the reducer $I_{\%} = \mathrm{reducer} \in \mathrm{computers}$, the independenter $I_{\mathrm{X}} = \mathrm{independenter} \in \mathrm{computers}$ is such that $I_{\mathrm{X}}^{ * }(A) = A^{\mathrm{X}}$, and $I_{\mathrm{\mathrm{S}\approx\mathrm{ln}!}} = \mathrm{sumlogfactorialer} \in \mathrm{computers}$ is defined \[ I_{\mathrm{\mathrm{S}\approx\mathrm{ln}!}}^{ * }(A) = \sum_{S \in A^{\mathrm{FS}}} I_{\mathrm{\approx\mathrm{ln}!}}^{ * }(A_S) \] where $I_{\mathrm{\approx\mathrm{ln}!}} = \mathrm{logfactorialer} \in \mathrm{computers}$ is defined $I_{\mathrm{\approx\mathrm{ln}!}}^{ * }(x) \approx \ln \Gamma_! x$.

The tuple set builder is defined in module AlignmentPracticable,

parametersSystemsBuilderTuple :: 
  Integer -> Integer -> Integer -> Integer -> System -> Set.Set Variable -> Fud -> Histogram -> Histogram ->  
  Maybe (Set.Set ((Set.Set Variable, Histogram, Histogram),Double))

as

parametersSystemsBuilderTuple xmax omax bmax mmax uu vv ff xx xxrr
  ...
  | ff == fudEmpty = 
      Just $ topd (bmax `div` mmax) $ buildb vv (init vv) Map.empty
  | fvars ff `subset` vars xx = 
      Just $ topd (bmax `div` mmax) $ buildb (fvars ff `union` vv) (init (fder ff)) Map.empty
  | otherwise = Nothing
  where
    init vv = llmm [(((sgl w, histogramEmpty, histogramEmpty),0),(0,0,0,0)) | w <- qqll vv]
    buildb ww qq nn = if mm /= Map.empty then buildb ww mm (nn `Map.union` mm) else (final nn) 
      where
        pp = llqq [jj | (((kk,_,_),_),_) <- mmll qq, w <- qqll (ww `minus` kk), let jj = kk `add` w]
        mm = top omax $ llmm [(((jj, bb, bbrr), a1-b1), (a1-a2-b1+b2, -l, -b1+b2, -u)) |
          jj <- qqll pp, let u = vol uu jj, u <= xmax, let l =  sumlayer ff jj, 
          let bb = xx `red` jj, let bbrr = xxrr `red` jj, 
          let a1 = sumfacln bb, let a2 = sumfacln (ind bb), 
          let b1 = sumfacln bbrr, let b2 = sumfacln (ind bbrr)]
    final nn = llmm [(((kk,aa,bb),y),a) | (((kk,aa,bb),y),a) <- mmll nn, card kk > 1]
    ...

For example,

let aa = resize 900 $ regpivot 3 3

let zzffcstupopt aa rr ff xmax omax = fst $ unzip $ fromJust $ parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple xmax omax (sys aa `uunion` fsys ff) aa rr ff

let buildtup xmax omax bmax mmax uu vv xx xxrr = map (\((kk,_,_),a) -> (kk,a)) $ Set.toList $ fromJust $ parametersSystemsBuilderTuple xmax omax bmax mmax uu vv fudEmpty xx xxrr

rpln $ zzffcstupopt aa (ind aa) fudEmpty (3^3) 3
"{({1,2},304.00445769104454),({1,3},304.00445769104454),({2,3},304.00445769104454)}"
"{({1,2,3},591.5865696692235)}"
"{}"

rpln $ buildtup (3^3) 3 2 2 (sys aa) (vars aa) aa (ind aa)
"({1,2,3},591.5865696692235)"

rpln $ buildtup (3^3) 3 (2*3) 2 (sys aa) (vars aa) aa (ind aa)
"({1,2,3},591.5865696692235)"
"({1,3},304.00445769104454)"
"({2,3},304.00445769104454)"

let buildfftup aa rr ff xmax omax bmax mmax = let vv = vars aa; ww = vv `Set.union` fvars ff; xx = apply vv ww (fhis ff) aa; xxrr = apply vv ww (fhis ff) rr in map (\((kk,_,_),a) -> (kk,a)) $ Set.toList $ fromJust $ parametersSystemsBuilderTuple xmax omax bmax mmax (sys aa `uunion` fsys ff) vv ff xx xxrr

let ff = llff [cdtt [1,15] [[1,1],[2,2],[3,2]], cdtt [2,16] [[1,1],[2,2],[3,2]], cdtt [3,17] [[1,1],[2,2],[3,2]]] 

rpln $ zzffcstupopt aa (ind aa) ff (3^3) 3
"{({15,16},308.77257318646025),({15,17},308.77257318646025),({16,17},308.77257318646025)}"
"{({2,15,17},608.5096573791252),({3,15,16},608.5096573791252),({15,16,17},614.6156145200293)}"
"{({1,15,16,17},608.5096573791252),({2,15,16,17},608.5096573791252),({3,15,16,17},608.5096573791252)}"
"{}"

rpln $ buildfftup aa (ind aa) ff (3^3) 3 (2*3) 2
"({2,15,17},608.5096573791252)"
"({3,15,16},608.5096573791252)"
"({15,16,17},614.6156145200293)"

No-sum-layer limited-underlying tuple set list builder

The computation of $\mathrm{sumlayer}(F,J)$ is costly so some implementations may exclude it, especially as it only affects tuples in the inclusion boundary (Text).

The tuple set builder, $I_{P,U,\mathrm{B,ns}}$, is defined in module AlignmentPracticable,

parametersSystemsBuilderTupleNoSumlayer :: 
  Integer -> Integer -> Integer -> Integer -> System -> Set.Set Variable -> Fud -> Histogram -> Histogram ->  
  Maybe (Set.Set ((Set.Set Variable, Histogram, Histogram),Double))

as

parametersSystemsBuilderTupleNoSumlayer xmax omax bmax mmax uu vv ff xx xxrr
  ...
  | ff == fudEmpty = 
      Just $ topd (bmax `div` mmax) $ buildb vv (init vv) Map.empty
  | fvars ff `subset` vars xx = 
      Just $ topd (bmax `div` mmax) $ buildb (fvars ff `union` vv) (init (fder ff)) Map.empty
  | otherwise = Nothing
  where
    init vv = llmm [(((sgl w, histogramEmpty, histogramEmpty),0),(0,0,0)) | w <- qqll vv]
    buildb ww qq nn = if mm /= Map.empty then buildb ww mm (nn `Map.union` mm) else (final nn) 
      where
        pp = llqq [jj | (((kk,_,_),_),_) <- mmll qq, w <- qqll (ww `minus` kk), let jj = kk `add` w]
        mm = top omax $ llmm [(((jj, bb, bbrr), a1-b1), (a1-a2-b1+b2, -b1+b2, -u)) |
          jj <- qqll pp, let u = vol uu jj, u <= xmax, 
          let bb = xx `red` jj, let bbrr = xxrr `red` jj, 
          let a1 = sumfacln bb, let a2 = sumfacln (ind bb), 
          let b1 = sumfacln bbrr, let b2 = sumfacln (ind bbrr)]
    final nn = llmm [(((kk,aa,bb),y),a) | (((kk,aa,bb),y),a) <- mmll nn, card kk > 1]
    ...

Multi-effective no-sum-layer limited-underlying tuple set list builder

Another performance improvement is to restrict the builder to variables that are multi-effective, $\{u : u \in V,~|(X\%\{u\})^{\mathrm{F}}|>1\}$ (Text).

The tuple set builder, $I_{P,U,\mathrm{B,ns,me}}$, is defined in module AlignmentPracticable,

parametersSystemsBuilderTupleNoSumlayerMultiEffective :: 
  Integer -> Integer -> Integer -> Integer -> System -> Set.Set Variable -> Fud -> Histogram -> Histogram ->  
  Maybe (Set.Set ((Set.Set Variable, Histogram, Histogram),Double))

as

parametersSystemsBuilderTupleNoSumlayerMultiEffective xmax omax bmax mmax uu vv ff xx xxrr
  ...
  | meff xx vv == empty = Just $ Set.empty
  | ff == fudEmpty = 
      Just $ topd (bmax `div` mmax) $ buildb (meff xx vv) (init (meff xx vv)) Map.empty
  | fvars ff `subset` vars xx = 
      Just $ topd (bmax `div` mmax) $ buildb (fvars ff `union` (meff xx vv)) (init (fder ff)) Map.empty
  | otherwise = Nothing
  where
    init vv = llmm [(((sgl w, histogramEmpty, histogramEmpty),0),(0,0,0)) | w <- qqll vv]
    buildb ww qq nn = if mm /= Map.empty then buildb ww mm (nn `Map.union` mm) else (final nn) 
      where
        pp = llqq [jj | (((kk,_,_),_),_) <- mmll qq, w <- qqll (ww `minus` kk), let jj = kk `add` w]
        mm = top omax $ llmm [(((jj, bb, bbrr), a1-b1), (a1-a2-b1+b2, -b1+b2, -u)) |
          jj <- qqll pp, let u = vol uu jj, u <= xmax, 
          let bb = xx `red` jj, let bbrr = xxrr `red` jj, 
          let a1 = sumfacln bb, let a2 = sumfacln (ind bb), 
          let b1 = sumfacln bbrr, let b2 = sumfacln (ind bbrr)]
    final nn = llmm [(((kk,aa,bb),y),a) | (((kk,aa,bb),y),a) <- mmll nn, card kk > 1]
    meff xx vv = Set.filter (\v -> acard (eff (xx `red` sgl v)) > 1) vv
    ...

An example of substrate analysis using the tuple set builder is described in Analysis of the UCI Machine Learning Repository Mushroom Data Set - Properties of the sample.

Level limited-underlying tuple set list maximiser

The level limited-underlying tuple set list maximiser $Z_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}}$ replaces the substrate variables, $V_A$, with the level variables, $V_{\mathrm{g}} \cup \mathrm{der}(F_{\mathrm{g}})$. Define the level limited-underlying tuple set list maximiser \[ \begin{eqnarray} &&Z_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}} = \\ &&\hspace{2em}\mathrm{maximiseLister}(X_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}},P_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}},\mathrm{top}(\mathrm{omax}),R_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}}) \end{eqnarray} \] The optimiser function is \[ \begin{eqnarray} &&X_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}} = \\ &&\hspace{2em}\{(K,I_{\mathrm{a}}^{ * }(\mathrm{apply}(V_A,K,\mathrm{his}(F \cup F_{\mathrm{g}}),A))-I_{\mathrm{a}}^{ * }(\mathrm{apply}(V_A,K,\mathrm{his}(F \cup F_{\mathrm{g}}),A_R))) :\\ &&\hspace{18em}K \in \mathrm{tuples}(V_{\mathrm{g}} \cup \mathrm{der}(F_{\mathrm{g}}),F)\} \end{eqnarray} \]

The neighbourhood function is (Text) \[ \begin{eqnarray} &&P_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}}(B) = \{(J,X_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}}(J)) : \\ &&\hspace{2em}(K,\cdot) \in B,~w \in \mathrm{vars}(F) \setminus \mathrm{vars}(F_{\mathrm{g}}) \cup V_{\mathrm{g}} \cup \mathrm{der}(F_{\mathrm{g}}) \setminus K,\\ &&\hspace{2em}J = K \cup \{w\},~|J^{\mathrm{C}}| \leq \mathrm{xmax}\} \end{eqnarray} \] The neighbourhood function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesLevelsFudsFunctionNeighbourhoodTuple :: 
  Integer -> System -> Histogram -> Histogram -> Set.Set Variable -> Fud -> Fud -> Map.Map (Set.Set Variable) Double -> 
  Maybe (Map.Map (Set.Set Variable) Double)

as

parametersSystemsSamplesShufflesLevelsFudsFunctionNeighbourhoodTuple xmax uu aa aarr vvg ffg ff bb
  ...
  | ... = Just $ llmm 
      [(jj, algn (apply vv jj xx aa) - algn (apply vv jj xx aarr)) |
        kk <- keys bb, w <- qqll (qq `minus` kk),  
        let jj = kk `add` w, vol uu jj <= xmax]
  | otherwise = Nothing
  where
    vv = vars aa
    qq = fvars ff `minus` fvars ffg `cup` vvg `cup` fder ffg
    xx = fhis ff `Set.union` fhis ffg
    ...

The initial subset is (Text) \[ \begin{eqnarray} R_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},\emptyset,\mathrm{B}} &=& \{(\{w,u\},X_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},\emptyset,\mathrm{B}}(\{w,u\})) : \\ &&\hspace{1em}w,u \in V_{\mathrm{g}} \cup \mathrm{der}(F_{\mathrm{g}}),~u \neq w,~|\{w,u\}^{\mathrm{C}}| \leq \mathrm{xmax}\} \\ R_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}} &=& \{(\{w,u\},X_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}}(\{w,u\})) : \\ &&\hspace{1em}w \in \mathrm{der}(F),~u \in \mathrm{vars}(F) \setminus \mathrm{vars}(F_{\mathrm{g}}) \cup V_{\mathrm{g}} \cup \mathrm{der}(F_{\mathrm{g}}),~u \neq w,\\ &&\hspace{1em}|\{w,u\}^{\mathrm{C}}| \leq \mathrm{xmax}\} \end{eqnarray} \] The initial function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesLevelsFudsFunctionInitialTuple :: 
  Integer -> System -> Histogram -> Histogram -> Set.Set Variable -> Fud -> Fud -> 
  Maybe (Map.Map (Set.Set Variable) Double)

as

parametersSystemsSamplesShufflesLevelsFudsFunctionInitialTuple xmax uu aa aarr vvg ffg ff
  ...
  | ... = Just $ llmm 
      [(kk, algn (apply vv kk xx aa) - algn (apply vv kk xx aarr)) |
        w <- qqll (if ff /= fudEmpty then ww else qq), u <- qqll qq, u /= w, 
        let kk = llqq [w,u], vol uu kk <= xmax]
  | otherwise = Nothing
  where
    ww = fder ff
    vv = vars aa
    qq = fvars ff `minus` fvars ffg `cup` vvg `cup` fder ffg
    xx = fhis ff `Set.union` fhis ffg
    ...

Then the shuffle content alignment optimised next level limited-underlying limited-breadth layer tuple set, $B_{\mathrm{B}}$, is (Text) \[ \begin{eqnarray} B_{\mathrm{B}} &=& \mathrm{topd}(\lfloor\mathrm{bmax}/\mathrm{mmax}\rfloor)(\mathrm{elements}(Z_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}})) \end{eqnarray} \] The optimiser function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesLevelsFudsFunctionOptimiserTuple :: 
  Integer -> Integer -> System -> Histogram -> Histogram -> Set.Set Variable -> Fud -> Fud ->  
  Maybe [(Map.Map (Set.Set Variable) Double, Map.Map (Set.Set Variable) Double)]

as

parametersSystemsSamplesShufflesLevelsFudsFunctionOptimiserTuple xmax omax uu aa aarr vvg ffg ff
  ...
  | ... = Just $ 
      opt (zzcstupneigh xmax uu aa aarr vvg ffg ff) (topff omax ff) (zzcstupinit xmax uu aa aarr vvg ffg ff)
  | otherwise = Nothing
  where
    opt pp ii rr = let qq = ii rr in (qq, rr) : ls qq
      where
        ls yy = if isempty yy then [] else let nn = pp yy; qq = ii nn in (qq, nn) : ls qq
    zzcstupinit xmax uu aa aarr vvg ffg ff =  fromJust $
      parametersSystemsSamplesShufflesLevelsFudsFunctionInitialTuple xmax uu aa aarr vvg ffg ff
    zzcstupneigh xmax uu aa aarr vvg ffg ff bb = fromJust $
      parametersSystemsSamplesShufflesLevelsFudsFunctionNeighbourhoodTuple xmax uu aa aarr vvg ffg ff bb
    ...

Level limited-underlying tuple set list builder

The tuple set builder, $I_{P,U,\mathrm{B,l}}$, is defined in module AlignmentPracticable,

parametersSystemsBuilderTupleLevel :: 
  Integer -> Integer -> Integer -> Integer -> System -> Set.Set Variable -> Fud -> Fud -> Histogram -> Histogram ->  
  Maybe (Set.Set ((Set.Set Variable, Histogram, Histogram),Double))

as

parametersSystemsBuilderTupleLevel xmax omax bmax mmax uu vvg ffg ff xx xxrr
  ...
  | ... = Just $ topd (bmax `div` mmax) $ buildb (fvars ff `minus` fvars ffg `union` vv) (init (fder ff)) Map.empty
  | otherwise = Nothing
  where
    vv = vvg `union` fder ffg
    init vv = llmm [(((sgl w, histogramEmpty, histogramEmpty),0),(0,0,0,0)) | w <- qqll vv]
    buildb ww qq nn = if mm /= Map.empty then buildb ww mm (nn `Map.union` mm) else (final nn) 
      where
        pp = llqq [jj | (((kk,_,_),_),_) <- mmll qq, w <- qqll (ww `minus` kk), let jj = kk `add` w]
        mm = top omax $ llmm [(((jj, bb, bbrr), a1-b1), (a1-a2-b1+b2, -l, -b1+b2, -u)) |
          jj <- qqll pp, let u = vol uu jj, u <= xmax, let l =  sumlayer ff jj, 
          let bb = xx `red` jj, let bbrr = xxrr `red` jj, 
          let a1 = sumfacln bb, let a2 = sumfacln (ind bb), 
          let b1 = sumfacln bbrr, let b2 = sumfacln (ind bbrr)]
    final nn = llmm [(((kk,aa,bb),y),a) | (((kk,aa,bb),y),a) <- mmll nn, card kk > 1]
    ...

Level no-sum-layer limited-underlying tuple set list builder

The tuple set builder, $I_{P,U,\mathrm{B,l,ns}}$, is defined in module AlignmentPracticable,

parametersSystemsBuilderTupleLevelNoSumlayer :: 
  Integer -> Integer -> Integer -> Integer -> System -> Set.Set Variable -> Fud -> Fud -> Histogram -> Histogram ->  
  Maybe (Set.Set ((Set.Set Variable, Histogram, Histogram),Double))

as

parametersSystemsBuilderTupleLevelNoSumlayer xmax omax bmax mmax uu vvg ffg ff xx xxrr
  ...
  | ... xx = Just $ topd (bmax `div` mmax) $ buildb (fvars ff `minus` fvars ffg `union` vv) (init (fder ff)) Map.empty
  | otherwise = Nothing
  where
    vv = vvg `union` fder ffg
    init vv = llmm [(((sgl w, histogramEmpty, histogramEmpty),0),(0,0,0)) | w <- qqll vv]
    buildb ww qq nn = if mm /= Map.empty then buildb ww mm (nn `Map.union` mm) else (final nn) 
      where
        pp = llqq [jj | (((kk,_,_),_),_) <- mmll qq, w <- qqll (ww `minus` kk), let jj = kk `add` w]
        mm = top omax $ llmm [(((jj, bb, bbrr), a1-b1), (a1-a2-b1+b2, -b1+b2, -u)) |
          jj <- qqll pp, let u = vol uu jj, u <= xmax, 
          let bb = xx `red` jj, let bbrr = xxrr `red` jj, 
          let a1 = sumfacln bb, let a2 = sumfacln (ind bb), 
          let b1 = sumfacln bbrr, let b2 = sumfacln (ind bbrr)]
    final nn = llmm [(((kk,aa,bb),y),a) | (((kk,aa,bb),y),a) <- mmll nn, card kk > 1]
    ...

Level multi-effective no-sum-layer limited-underlying tuple set list builder

The tuple set builder, $I_{P,U,\mathrm{B,l,ns,me}}$, is defined in module AlignmentPracticable,

parametersSystemsBuilderTupleLevelNoSumlayerMultiEffective :: 
  Integer -> Integer -> Integer -> Integer -> System -> Set.Set Variable -> Fud -> Fud -> Histogram -> Histogram ->  
  Maybe (Set.Set ((Set.Set Variable, Histogram, Histogram),Double))

as

parametersSystemsBuilderTupleLevelNoSumlayerMultiEffective xmax omax bmax mmax uu vvg ffg ff xx xxrr
  ...
  | ... = Just $ topd (bmax `div` mmax) $ buildb (fvars ff `minus` fvars ffg `union` vv') (init (fder ff)) Map.empty
  | otherwise = Nothing
  where
    vv = vvg `union` fder ffg
    vv' = meff xx vv
    init vv = llmm [(((sgl w, histogramEmpty, histogramEmpty),0),(0,0,0)) | w <- qqll vv]
    buildb ww qq nn = if mm /= Map.empty then buildb ww mm (nn `Map.union` mm) else (final nn) 
      where
        pp = llqq [jj | (((kk,_,_),_),_) <- mmll qq, w <- qqll (ww `minus` kk), let jj = kk `add` w]
        mm = top omax $ llmm [(((jj, bb, bbrr), a1-b1), (a1-a2-b1+b2, -b1+b2, -u)) |
          jj <- qqll pp, let u = vol uu jj, u <= xmax, 
          let bb = xx `red` jj, let bbrr = xxrr `red` jj, 
          let a1 = sumfacln bb, let a2 = sumfacln (ind bb), 
          let b1 = sumfacln bbrr, let b2 = sumfacln (ind bbrr)]
    final nn = llmm [(((kk,aa,bb),y),a) | (((kk,aa,bb),y),a) <- mmll nn, card kk > 1]
    meff xx vv = Set.filter (\v -> acard (eff (xx `red` sgl v)) > 1) vv
    ...

top