Fud searchers

Haskell commentary on the implementation of Tractable and Practicable Inducers/Haskell Implementation/Fud searchers

Sections

Limited-layer limited-underlying limited-breadth fud tree searcher

Highest-layer limited-layer limited-underlying limited-breadth fud tree searcher

Maximum-roll-by-derived-dimension limited-layer limited-underlying limited-breadth fud tree searcher

Excluded-self limited-layer limited-underlying limited-breadth fud tree searcher

Highest-layer layerer

Maximum-roll highest-layer layerer

Excluded-self maximum-roll highest-layer layerer

Excluded-self maximum-roll-by-derived-dimension highest-layer layerer

Level limited-layer limited-underlying limited-breadth fud tree searcher

Level excluded-self maximum-roll highest-layer layerer

Level excluded-self maximum-roll-by-derived-dimension highest-layer layerer

Limited-layer limited-underlying limited-breadth fud tree searcher

The limited-layer limited-underlying limited-breadth fud tree searcher creates a path of layer-cumulative fuds of length $\mathrm{lmax}$. Define the limited-layer limited-underlying limited-breadth fud tree searcher (Text) \[ Z_{P,A,A_R,\mathrm{L}} = \mathrm{searchTreer}(\mathcal{F}_{\infty,U_A,V_A} \cap \mathcal{F}_{\mathrm{u}} \cap \mathcal{F}_{\mathrm{b}} \cap \mathcal{F}_{\mathrm{h}},P_{P,A,A_R,\mathrm{L}},\{\emptyset\}) \] where the neighbourhood function returns a singleton \[ \begin{eqnarray} &&P_{P,A,A_R,\mathrm{L}}(F) = \{G :\\ &&\hspace{2em}G = F \cup \{T : K \in \mathrm{topd}(\lfloor\mathrm{bmax}/\mathrm{mmax}\rfloor)(\mathrm{elements}(Z_{P,A,A_R,F,\mathrm{B}})),\\ &&\hspace{5em}H \in \mathrm{topd}(\mathrm{pmax})(\mathrm{elements}(Z_{P,A,A_R,F,\mathrm{n},-,K})),\\ &&\hspace{5em}w \in \mathrm{der}(H),~I = \mathrm{depends}(\mathrm{explode}(H),\{w\}),~T = I^{\mathrm{TPT}}\},\\ &&\hspace{2em}\mathrm{layer}(G, \mathrm{der}(G)) \leq \mathrm{lmax}\} \end{eqnarray} \] If the substrate variables are pluri-variate, $|V_A| > 1$, the optimised limited-layer limited-underlying limited-breadth fud $F_{\mathrm{L}}$ of layer $\mathrm{lmax}$ is the leaf \[ \begin{eqnarray} \{F_{\mathrm{L}}\} = \mathrm{leaves}(\mathrm{tree}(Z_{P,A,A_R,\mathrm{L}})) \subset \mathcal{F}_{\infty,U_A,V_A} \cap \mathcal{F}_{\mathrm{u}} \cap \mathcal{F}_{\mathrm{b}} \cap \mathcal{F}_{\mathrm{h}} \end{eqnarray} \] If the optimised limited-layer limited-underlying limited-breadth fud, $F_{\mathrm{L}}$, exists, it has at least two variables, $|\mathrm{vars}(F_{\mathrm{L}}) \setminus V_A| > 1$.

The fud tree search function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesSearcherFud :: 
  Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> 
  System -> Histogram -> Histogram ->
  Maybe [Fud]

as

parametersSystemsSamplesShufflesSearcherFud lmax xmax omax bmax mmax umax pmax uu aa aarr
  ...
  | ... = Just $ ls uu fudEmpty lmax
  | otherwise = Nothing
  where
    ls _ _ 0 = []
    ls uu ff h = gg : ls (uu `uunion` fsys gg) gg (h-1)
      where
        gg = ff `funion` llff [(pptt . ttpp . fftt) (depends (fexplode hh) w) | 
               kk <- topff (bmax `div` mmax) ff (zzffcstupopt xmax omax uu aa aarr ff), 
               hh <- top pmax (zzcsddecoptw mmax umax pmax uu aa aarr ff kk), w <- qqll (fder hh)]
    zzffcstupopt xmax omax uu aa aarr ff = fst $ unzip $ fromJust $ 
      parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple xmax omax uu aa aarr ff
    zzcsddecoptw mmax umax pmax uu aa aarr ff kk = fst $ unzip $ fromJust $
      parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementingLimitedValency 
        mmax umax pmax uu aa aarr ff kk
    ...

Note that this implementation is additionally constrained to be limited-valency. See the limited-valency contracted decrementing linear non-overlapping fuds list maximiser in Tuple Optimisation, which is implemented in Decrementing maximiser.

An implementation with the partition variables replaced by cardinal variables has an additional argument of a list of variables, [Variable]. It is also defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesListVariablesSearcherFud :: 
  Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> 
  System -> Histogram -> Histogram -> [Variable] ->
  Maybe ([Fud],(System,[Variable]))

as

parametersSystemsSamplesShufflesListVariablesSearcherFud lmax xmax omax bmax mmax umax pmax uu aa aarr ll
  ...
  | ... = Just $ (pp,(uu',ll'))
  | otherwise = Nothing
  where
    qq = ls fudEmpty uu ll lmax
    pp = fst $ unzip $ qq
    (uu',ll') = if qq /= [] then (last $ snd $ unzip qq) else (uu,ll)
    ls _ _ _ 0 = []
    ls ff uu ll h = (gg,(uu',ll')) : ls gg uu' ll' (h-1)
      where
        yy = ls2 (topff (bmax `div` mmax) ff (zzffcstupopt xmax omax uu aa aarr ff)) uu ll
        gg = ff `funion` llff (elems (llmm [(rr, tt) | hh <- (concat $ fst $ unzip yy), 
                                             w <- qqll (fder hh), let tt = fftt (depends hh w), 
                                             let rr = ttpp tt, rr `notmem` nn]))
        (uu',ll') = if yy /= [] then (last $ snd $ unzip yy) else (uu,ll)
        nn = llqq [ttpp tt | tt <- (qqll . ffqq) ff]
        ls2 [] _ _ = []
        ls2 (kk:bb) uu ll = (top pmax (fst $ unzip xx),(uu',ll')) : ls2 bb uu' ll'
          where
            (xx,(uu',ll')) = zzllcsddecoptw mmax umax pmax uu aa aarr ff kk ll
    zzffcstupopt xmax omax uu aa aarr ff = fst $ unzip $ fromJust $ 
      parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple xmax omax uu aa aarr ff
    zzllcsddecoptw mmax umax pmax uu aa aarr ff kk ll = fromJust $
      parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionOptimiserFudDecrementingLimitedValency 
        mmax umax pmax uu aa aarr ff kk ll
    ...

For example,

let zzfuds aa aarr lmax xmax omax bmax mmax umax pmax = fromJust $ parametersSystemsSamplesShufflesSearcherFud lmax xmax omax bmax mmax umax pmax (sys aa) aa aarr

let zzllfuds aa aarr lmax xmax omax bmax mmax umax pmax = fst $ fromJust $ parametersSystemsSamplesShufflesListVariablesSearcherFud lmax xmax omax bmax mmax umax pmax (sys aa) aa aarr [VarInt i | i <-[10..]]


let aa = resize 100 $ regpivot 3 2

rpln $ map fmpi $ zzfuds aa (ind aa) 1 (3^2) 2 2 2 (3^2) 1
"{({({(1,1),(3,1)},1 % 1),({(1,2),(3,2)},1 % 1),({(1,3),(3,2)},1 % 1)},{3}),({({(2,1),(4,1)},1 % 1),({(2,2),(4,2)},1 % 1),({(2,3),(4,2)},1 % 1)},{4})}"


let aa = resize 100 $ regpivot 3 3

rpln $ zzllfuds aa (ind aa) 1 (3^3) 3 3 3 (3^3) 1
"{({({(1,1),(64,1)},1 % 1),({(1,2),(64,2)},1 % 1),({(1,3),(64,2)},1 % 1)},{64}),({({(2,1),(65,1)},1 % 1),({(2,2),(65,2)},1 % 1),({(2,3),(65,2)},1 % 1)},{65}),({({(3,1),(66,1)},1 % 1),({(3,2),(66,2)},1 % 1),({(3,3),(66,2)},1 % 1)},{66})}"


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

rpln $ zzllfuds aa (ind aa) 1 (3^3) 3 3 3 (3^3) 1
"{({({(1,1),(24,1)},1 % 1),({(1,2),(24,2)},1 % 1),({(1,3),(24,2)},1 % 1)},{24}),({({(2,1),(25,1)},1 % 1),({(2,2),(25,2)},1 % 1),({(2,3),(25,2)},1 % 1)},{25})}"

rpln $ zzllfuds aa (ind aa) 2 (3^3) 3 3 3 (3^3) 1
"{({({(1,1),(24,1)},1 % 1),({(1,2),(24,2)},1 % 1),({(1,3),(24,2)},1 % 1)},{24}),({({(2,1),(25,1)},1 % 1),({(2,2),(25,2)},1 % 1),({(2,3),(25,2)},1 % 1)},{25})}"
"{({({(1,1),(24,1)},1 % 1),({(1,2),(24,2)},1 % 1),({(1,3),(24,2)},1 % 1)},{24}),({({(2,1),(25,1)},1 % 1),({(2,2),(25,2)},1 % 1),({(2,3),(25,2)},1 % 1)},{25}),({({(24,1),(30,1)},1 % 1),({(24,2),(30,2)},1 % 1)},{30}),({({(25,1),(31,1)},1 % 1),({(25,2),(31,2)},1 % 1)},{31})}"

rpln $ zzllfuds aa (ind aa) 1 (3^4) 3 3 3 (3^4) 1
"{({({(1,1),(625,1)},1 % 1),({(1,2),(625,2)},1 % 1),({(1,3),(625,2)},1 % 1)},{625}),({({(2,1),(4,1),(624,1)},1 % 1),({(2,1),(4,2),(624,1)},1 % 1),({(2,1),(4,3),(624,1)},1 % 1),({(2,2),(4,1),(624,2)},1 % 1),({(2,2),(4,2),(624,3)},1 % 1),({(2,2),(4,3),(624,3)},1 % 1),({(2,3),(4,1),(624,2)},1 % 1),({(2,3),(4,2),(624,3)},1 % 1),({(2,3),(4,3),(624,3)},1 % 1)},{624}),({({(3,1),(626,1)},1 % 1),({(3,2),(626,2)},1 % 1),({(3,3),(626,2)},1 % 1)},{626})}"

rpln $ zzllfuds aa (ind aa) 2 (3^4) 3 3 3 (3^4) 1
"{({({(1,1),(625,1)},1 % 1),({(1,2),(625,2)},1 % 1),({(1,3),(625,2)},1 % 1)},{625}),({({(2,1),(4,1),(624,1)},1 % 1),({(2,1),(4,2),(624,1)},1 % 1),({(2,1),(4,3),(624,1)},1 % 1),({(2,2),(4,1),(624,2)},1 % 1),({(2,2),(4,2),(624,3)},1 % 1),({(2,2),(4,3),(624,3)},1 % 1),({(2,3),(4,1),(624,2)},1 % 1),({(2,3),(4,2),(624,3)},1 % 1),({(2,3),(4,3),(624,3)},1 % 1)},{624}),({({(3,1),(626,1)},1 % 1),({(3,2),(626,2)},1 % 1),({(3,3),(626,2)},1 % 1)},{626})}"
"{({({(1,1),(625,1)},1 % 1),({(1,2),(625,2)},1 % 1),({(1,3),(625,2)},1 % 1)},{625}),({({(2,1),(4,1),(624,1)},1 % 1),({(2,1),(4,2),(624,1)},1 % 1),({(2,1),(4,3),(624,1)},1 % 1),({(2,2),(4,1),(624,2)},1 % 1),({(2,2),(4,2),(624,3)},1 % 1),({(2,2),(4,3),(624,3)},1 % 1),({(2,3),(4,1),(624,2)},1 % 1),({(2,3),(4,2),(624,3)},1 % 1),({(2,3),(4,3),(624,3)},1 % 1)},{624}),({({(3,1),(626,1)},1 % 1),({(3,2),(626,2)},1 % 1),({(3,3),(626,2)},1 % 1)},{626}),({({(4,1),(748,1)},1 % 1),({(4,2),(748,2)},1 % 1),({(4,3),(748,2)},1 % 1)},{748}),({({(624,1),(747,1)},1 % 1),({(624,2),(747,2)},1 % 1),({(624,3),(747,2)},1 % 1)},{747}),({({(625,1),(626,1),(746,1)},1 % 1),({(625,1),(626,2),(746,1)},1 % 1),({(625,2),(626,1),(746,2)},1 % 1),({(625,2),(626,2),(746,3)},1 % 1)},{746})}"

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

let aa = hhaa hh

rpln $ zzllfuds aa (ind aa) 1 (3^4) 4 4 4 (3^4) 1
"{({({(cloud,heavy),(108,1)},1 % 1),({(cloud,light),(108,2)},1 % 1),({(cloud,none),(108,3)},1 % 1)},{108}),({({(pressure,high),(106,1)},1 % 1),({(pressure,low),(106,2)},1 % 1),({(pressure,medium),(106,2)},1 % 1)},{106}),({({(rain,heavy),(109,1)},1 % 1),({(rain,light),(109,2)},1 % 1),({(rain,none),(109,3)},1 % 1)},{109}),({({(wind,light),(107,1)},1 % 1),({(wind,none),(107,1)},1 % 1),({(wind,strong),(107,2)},1 % 1)},{107})}"


let ff1 = zzllfuds aa (ind aa) 1 (3^4) 4 4 4 (3^4) 1 !! 0

Set.size $ ffqq ff1
4

rp $ fvars ff1
"{cloud,pressure,rain,wind,106,107,108,109}"

rp $ fder ff1
"{106,107,108,109}"

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff1
"({(cloud,heavy),(108,1)},1 % 1)"
"({(cloud,light),(108,2)},1 % 1)"
"({(cloud,none),(108,3)},1 % 1)"
"({(pressure,high),(106,1)},1 % 1)"
"({(pressure,low),(106,2)},1 % 1)"
"({(pressure,medium),(106,2)},1 % 1)"
"({(rain,heavy),(109,1)},1 % 1)"
"({(rain,light),(109,2)},1 % 1)"
"({(rain,none),(109,3)},1 % 1)"
"({(wind,light),(107,1)},1 % 1)"
"({(wind,none),(107,1)},1 % 1)"
"({(wind,strong),(107,2)},1 % 1)"

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [pressure, VarInt 106]
"({(pressure,high),(106,1)},27 % 1)"
"({(pressure,low),(106,2)},27 % 1)"
"({(pressure,medium),(106,2)},27 % 1)"

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [wind, VarInt 107]
"({(wind,light),(107,1)},27 % 1)"
"({(wind,none),(107,1)},27 % 1)"
"({(wind,strong),(107,2)},27 % 1)"

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [cloud, VarInt 108]
"({(cloud,heavy),(108,1)},27 % 1)"
"({(cloud,light),(108,2)},27 % 1)"
"({(cloud,none),(108,3)},27 % 1)"

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [rain, VarInt 109]
"({(rain,heavy),(109,1)},27 % 1)"
"({(rain,light),(109,2)},27 % 1)"
"({(rain,none),(109,3)},27 % 1)"

rpln $ aall $ aa `fapply` ff1
"({(106,1),(107,1),(108,2),(109,1)},1 % 1)"
"({(106,1),(107,1),(108,3),(109,3)},5 % 1)"
"({(106,1),(107,2),(108,2),(109,2)},1 % 1)"
"({(106,2),(107,1),(108,1),(109,1)},2 % 1)"
"({(106,2),(107,1),(108,2),(109,2)},3 % 1)"
"({(106,2),(107,1),(108,2),(109,3)},1 % 1)"
"({(106,2),(107,1),(108,3),(109,2)},3 % 1)"
"({(106,2),(107,1),(108,3),(109,3)},1 % 1)"
"({(106,2),(107,2),(108,1),(109,1)},2 % 1)"
"({(106,2),(107,2),(108,2),(109,1)},1 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff1)) `divide` (norm (vvc `fapply` ff1))
"({(106,1),(107,1),(108,2),(109,1)},2.025)"
"({(106,1),(107,1),(108,3),(109,3)},10.125)"
"({(106,1),(107,2),(108,2),(109,2)},4.05)"
"({(106,2),(107,1),(108,1),(109,1)},2.025)"
"({(106,2),(107,1),(108,2),(109,2)},3.0375)"
"({(106,2),(107,1),(108,2),(109,3)},1.0125)"
"({(106,2),(107,1),(108,3),(109,2)},3.0375)"
"({(106,2),(107,1),(108,3),(109,3)},1.0125)"
"({(106,2),(107,2),(108,1),(109,1)},4.05)"
"({(106,2),(107,2),(108,2),(109,1)},2.025)"

algn $ aa `fapply` ff1
11.110317593941938

algnden $ aa `fapply` ff1
4.535768164237377

ent (aa `fapply` ff1)
2.1251596727330435

cent (fftt ff1) aa
0.4285218852967525

rent (aa `fapply` ff1) (vvc `fapply` ff1)
19.712467277237238

This is the unconstrained tuple partition cardinality case where let mmax = 4, already described in Decrementing maximiser.

Now consider let lmax = 2,

rpln $ zzllfuds aa (ind aa) 2 (3^4) 4 4 4 (3^4) 1
"{({({(cloud,heavy),(108,1)},1 % 1),({(cloud,light),(108,2)},1 % 1),({(cloud,none),(108,3)},1 % 1)},{108}),({({(pressure,high),(106,1)},1 % 1),({(pressure,low),(106,2)},1 % 1),({(pressure,medium),(106,2)},1 % 1)},{106}),({({(rain,heavy),(109,1)},1 % 1),({(rain,light),(109,2)},1 % 1),({(rain,none),(109,3)},1 % 1)},{109}),({({(wind,light),(107,1)},1 % 1),({(wind,none),(107,1)},1 % 1),({(wind,strong),(107,2)},1 % 1)},{107})}"
"{({({(cloud,heavy),(108,1)},1 % 1),({(cloud,light),(108,2)},1 % 1),({(cloud,none),(108,3)},1 % 1)},{108}),({({(pressure,high),(106,1)},1 % 1),({(pressure,low),(106,2)},1 % 1),({(pressure,medium),(106,2)},1 % 1)},{106}),({({(rain,heavy),(109,1)},1 % 1),({(rain,light),(109,2)},1 % 1),({(rain,none),(109,3)},1 % 1)},{109}),({({(wind,light),(107,1)},1 % 1),({(wind,none),(107,1)},1 % 1),({(wind,strong),(107,2)},1 % 1)},{107}),({({(107,1),(216,1)},1 % 1),({(107,2),(216,2)},1 % 1)},{216}),({({(109,1),(217,1)},1 % 1),({(109,2),(217,2)},1 % 1),({(109,3),(217,3)},1 % 1)},{217})}"

let ff2 = zzllfuds aa (ind aa) 2 (3^4) 4 4 4 (3^4) 1 !! 1

Set.size $ ffqq ff2
6

rp $ fvars ff2
"{cloud,pressure,rain,wind,106,107,108,109,216,217}"

rp $ fder ff2
"{106,108,216,217}"

rpln $ aall $ (foldl1 mul (fhis ff2)) `red` [VarInt 109, VarInt 217]
"({(109,1),(217,1)},27 % 1)"
"({(109,2),(217,2)},27 % 1)"
"({(109,3),(217,3)},27 % 1)"

rpln $ aall $ (foldl1 mul (fhis ff2)) `red` [VarInt 107, VarInt 216]
"({(107,1),(216,1)},54 % 1)"
"({(107,2),(216,2)},27 % 1)"

let approx a b = round (a * 10^6) == round (b * 10^6)

algn (aa `fapply` ff1) `approx` algn (aa `fapply` ff2)
True

The extra layer adds another two variables, 216 and 217, but does not increase the model alignment.

Now impose the constraint let mmax = 3,

rpln $ zzllfuds aa (ind aa) 1 (3^4) 4 4 3 (3^4) 1
"{({({(cloud,heavy),(543,1)},1 % 1),({(cloud,light),(543,2)},1 % 1),({(cloud,none),(543,2)},1 % 1)},{543}),({({(pressure,high),(wind,light),(544,1)},1 % 1),({(pressure,high),(wind,none),(544,1)},1 % 1),({(pressure,high),(wind,strong),(544,1)},1 % 1),({(pressure,low),(wind,light),(544,2)},1 % 1),({(pressure,low),(wind,none),(544,1)},1 % 1),({(pressure,low),(wind,strong),(544,2)},1 % 1),({(pressure,medium),(wind,light),(544,1)},1 % 1),({(pressure,medium),(wind,none),(544,1)},1 % 1),({(pressure,medium),(wind,strong),(544,1)},1 % 1)},{544}),({({(rain,heavy),(545,1)},1 % 1),({(rain,light),(545,2)},1 % 1),({(rain,none),(545,2)},1 % 1)},{545})}"


let ff1 = zzllfuds aa (ind aa) 1 (3^4) 4 4 3 (3^4) 1 !! 0

Set.size $ ffqq ff1
3

rp $ fvars ff1
"{cloud,pressure,rain,wind,543,544,545}"

rp $ fder ff1
"{543,544,545}"

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff1
"({(cloud,heavy),(543,1)},1 % 1)"
"({(cloud,light),(543,2)},1 % 1)"
"({(cloud,none),(543,2)},1 % 1)"
"({(pressure,high),(wind,light),(544,1)},1 % 1)"
"({(pressure,high),(wind,none),(544,1)},1 % 1)"
"({(pressure,high),(wind,strong),(544,1)},1 % 1)"
"({(pressure,low),(wind,light),(544,2)},1 % 1)"
"({(pressure,low),(wind,none),(544,1)},1 % 1)"
"({(pressure,low),(wind,strong),(544,2)},1 % 1)"
"({(pressure,medium),(wind,light),(544,1)},1 % 1)"
"({(pressure,medium),(wind,none),(544,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(544,1)},1 % 1)"
"({(rain,heavy),(545,1)},1 % 1)"
"({(rain,light),(545,2)},1 % 1)"
"({(rain,none),(545,2)},1 % 1)"

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [pressure, wind, VarInt 544]
"({(pressure,high),(wind,light),(544,1)},9 % 1)"
"({(pressure,high),(wind,none),(544,1)},9 % 1)"
"({(pressure,high),(wind,strong),(544,1)},9 % 1)"
"({(pressure,low),(wind,light),(544,2)},9 % 1)"
"({(pressure,low),(wind,none),(544,1)},9 % 1)"
"({(pressure,low),(wind,strong),(544,2)},9 % 1)"
"({(pressure,medium),(wind,light),(544,1)},9 % 1)"
"({(pressure,medium),(wind,none),(544,1)},9 % 1)"
"({(pressure,medium),(wind,strong),(544,1)},9 % 1)"

Re-arranging to show the components,

"({(pressure,high),(wind,none),(544,1)},9 % 1)"
"({(pressure,high),(wind,light),(544,1)},9 % 1)"
"({(pressure,high),(wind,strong),(544,1)},9 % 1)"
"({(pressure,medium),(wind,none),(544,1)},9 % 1)"
"({(pressure,medium),(wind,light),(544,1)},9 % 1)"
"({(pressure,medium),(wind,strong),(544,1)},9 % 1)"
"({(pressure,low),(wind,none),(544,1)},9 % 1)"

"({(pressure,low),(wind,light),(544,2)},9 % 1)"
"({(pressure,low),(wind,strong),(544,2)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [cloud, VarInt 543]
"({(cloud,heavy),(543,1)},27 % 1)"
"({(cloud,light),(543,2)},27 % 1)"
"({(cloud,none),(543,2)},27 % 1)"

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [rain, VarInt 545]
"({(rain,heavy),(545,1)},27 % 1)"
"({(rain,light),(545,2)},27 % 1)"
"({(rain,none),(545,2)},27 % 1)"

rpln $ aall $ aa `fapply` ff1
"({(543,1),(544,2),(545,1)},4 % 1)"
"({(543,2),(544,1),(545,1)},2 % 1)"
"({(543,2),(544,1),(545,2)},13 % 1)"
"({(543,2),(544,2),(545,2)},1 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff1)) `divide` (norm (vvc `fapply` ff1))
"({(543,1),(544,2),(545,1)},8.1)"
"({(543,2),(544,1),(545,1)},0.5785714285714286)"
"({(543,2),(544,1),(545,2)},1.8803571428571428)"
"({(543,2),(544,2),(545,2)},0.50625)"

algn $ aa `fapply` ff1
10.17171306045358

algnden $ aa `fapply` ff1
5.08585653022679

ent (aa `fapply` ff1)
0.9819416009240194

cent (fftt ff1) aa
1.571739957105777

rent (aa `fapply` ff1) (vvc `fapply` ff1)
11.664861945989742

This is the highest alignment valency-density case where let mmax = 3 already described in Decrementing maximiser.

Now consider let lmax = 2,

rpln $ zzllfuds aa (ind aa) 2 (3^4) 4 4 3 (3^4) 1
"{({({(cloud,heavy),(543,1)},1 % 1),({(cloud,light),(543,2)},1 % 1),({(cloud,none),(543,2)},1 % 1)},{543}),({({(pressure,high),(wind,light),(544,1)},1 % 1),({(pressure,high),(wind,none),(544,1)},1 % 1),({(pressure,high),(wind,strong),(544,1)},1 % 1),({(pressure,low),(wind,light),(544,2)},1 % 1),({(pressure,low),(wind,none),(544,1)},1 % 1),({(pressure,low),(wind,strong),(544,2)},1 % 1),({(pressure,medium),(wind,light),(544,1)},1 % 1),({(pressure,medium),(wind,none),(544,1)},1 % 1),({(pressure,medium),(wind,strong),(544,1)},1 % 1)},{544}),({({(rain,heavy),(545,1)},1 % 1),({(rain,light),(545,2)},1 % 1),({(rain,none),(545,2)},1 % 1)},{545})}"
"{({({(cloud,heavy),(543,1)},1 % 1),({(cloud,light),(543,2)},1 % 1),({(cloud,none),(543,2)},1 % 1)},{543}),({({(pressure,high),(wind,light),(544,1)},1 % 1),({(pressure,high),(wind,none),(544,1)},1 % 1),({(pressure,high),(wind,strong),(544,1)},1 % 1),({(pressure,low),(wind,light),(544,2)},1 % 1),({(pressure,low),(wind,none),(544,1)},1 % 1),({(pressure,low),(wind,strong),(544,2)},1 % 1),({(pressure,medium),(wind,light),(544,1)},1 % 1),({(pressure,medium),(wind,none),(544,1)},1 % 1),({(pressure,medium),(wind,strong),(544,1)},1 % 1)},{544}),({({(pressure,high),(544,1),(778,1)},1 % 1),({(pressure,high),(544,2),(778,1)},1 % 1),({(pressure,low),(544,1),(778,1)},1 % 1),({(pressure,low),(544,2),(778,2)},1 % 1),({(pressure,medium),(544,1),(778,1)},1 % 1),({(pressure,medium),(544,2),(778,1)},1 % 1)},{778}),({({(rain,heavy),(545,1)},1 % 1),({(rain,light),(545,2)},1 % 1),({(rain,none),(545,2)},1 % 1)},{545})}"


let ff2 = zzllfuds aa (ind aa) 2 (3^4) 4 4 3 (3^4) 1 !! 1

Set.size $ ffqq ff2
4

rp $ fvars ff2
"{cloud,pressure,rain,wind,543,544,545,778}"

rp $ fder ff2
"{543,545,778}"

rpln $ aall $ (foldl1 mul (fhis ff2)) `red` [pressure,  VarInt 544, VarInt 778]
"({(pressure,high),(544,1),(778,1)},27 % 1)"
"({(pressure,low),(544,1),(778,1)},9 % 1)"
"({(pressure,low),(544,2),(778,2)},18 % 1)"
"({(pressure,medium),(544,1),(778,1)},27 % 1)"

rpln $ aall $ (ttaa $ fftt $ ff2) `red` [pressure, wind, VarInt 778]
"({(pressure,high),(wind,light),(778,1)},9 % 1)"
"({(pressure,high),(wind,none),(778,1)},9 % 1)"
"({(pressure,high),(wind,strong),(778,1)},9 % 1)"
"({(pressure,low),(wind,light),(778,2)},9 % 1)"
"({(pressure,low),(wind,none),(778,1)},9 % 1)"
"({(pressure,low),(wind,strong),(778,2)},9 % 1)"
"({(pressure,medium),(wind,light),(778,1)},9 % 1)"
"({(pressure,medium),(wind,none),(778,1)},9 % 1)"
"({(pressure,medium),(wind,strong),(778,1)},9 % 1)"

algn (aa `fapply` ff1) == algn (aa `fapply` ff2) 
True

The extra layer adds another variable, 778, but does not increase the model alignment.

Now impose the constraint let mmax = 2,

rpln $ zzllfuds aa (ind aa) 1 (3^4) 4 4 2 (3^4) 1
"{({({(cloud,heavy),(rain,heavy),(930,1)},1 % 1),({(cloud,heavy),(rain,light),(930,1)},1 % 1),({(cloud,heavy),(rain,none),(930,1)},1 % 1),({(cloud,light),(rain,heavy),(930,2)},1 % 1),({(cloud,light),(rain,light),(930,2)},1 % 1),({(cloud,light),(rain,none),(930,2)},1 % 1),({(cloud,none),(rain,heavy),(930,1)},1 % 1),({(cloud,none),(rain,light),(930,1)},1 % 1),({(cloud,none),(rain,none),(930,2)},1 % 1)},{930}),({({(cloud,heavy),(1225,1)},1 % 1),({(cloud,light),(1225,2)},1 % 1),({(cloud,none),(1225,2)},1 % 1)},{1225}),({({(pressure,high),(rain,heavy),(1224,1)},1 % 1),({(pressure,high),(rain,light),(1224,1)},1 % 1),({(pressure,high),(rain,none),(1224,1)},1 % 1),({(pressure,low),(rain,heavy),(1224,2)},1 % 1),({(pressure,low),(rain,light),(1224,1)},1 % 1),({(pressure,low),(rain,none),(1224,1)},1 % 1),({(pressure,medium),(rain,heavy),(1224,1)},1 % 1),({(pressure,medium),(rain,light),(1224,1)},1 % 1),({(pressure,medium),(rain,none),(1224,1)},1 % 1)},{1224}),({({(pressure,high),(wind,light),(931,1)},1 % 1),({(pressure,high),(wind,none),(931,1)},1 % 1),({(pressure,high),(wind,strong),(931,1)},1 % 1),({(pressure,low),(wind,light),(931,2)},1 % 1),({(pressure,low),(wind,none),(931,1)},1 % 1),({(pressure,low),(wind,strong),(931,2)},1 % 1),({(pressure,medium),(wind,light),(931,2)},1 % 1),({(pressure,medium),(wind,none),(931,1)},1 % 1),({(pressure,medium),(wind,strong),(931,1)},1 % 1)},{931})}"

let ff1 = zzllfuds aa (ind aa) 1 (3^4) 4 4 2 (3^4) 1 !! 0

Set.size $ ffqq ff1
4

rp $ fvars ff1
"{cloud,pressure,rain,wind,930,931,1224,1225}"

rp $ fder ff1
"{930,931,1224,1225}"

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [pressure, wind, VarInt 931]
"({(pressure,high),(wind,light),(931,1)},9 % 1)"
"({(pressure,high),(wind,none),(931,1)},9 % 1)"
"({(pressure,high),(wind,strong),(931,1)},9 % 1)"
"({(pressure,low),(wind,light),(931,2)},9 % 1)"
"({(pressure,low),(wind,none),(931,1)},9 % 1)"
"({(pressure,low),(wind,strong),(931,2)},9 % 1)"
"({(pressure,medium),(wind,light),(931,2)},9 % 1)"
"({(pressure,medium),(wind,none),(931,1)},9 % 1)"
"({(pressure,medium),(wind,strong),(931,1)},9 % 1)"

Re-arranging to show the components,

"({(pressure,high),(wind,none),(931,1)},9 % 1)"
"({(pressure,high),(wind,light),(931,1)},9 % 1)"
"({(pressure,high),(wind,strong),(931,1)},9 % 1)"
"({(pressure,medium),(wind,none),(931,1)},9 % 1)"
"({(pressure,medium),(wind,strong),(931,1)},9 % 1)"
"({(pressure,low),(wind,none),(931,1)},9 % 1)"

"({(pressure,medium),(wind,light),(931,2)},9 % 1)"
"({(pressure,low),(wind,light),(931,2)},9 % 1)"
"({(pressure,low),(wind,strong),(931,2)},9 % 1)"

Cloud and rain are also in a component together,

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [cloud, rain, VarInt 930]
"({(cloud,heavy),(rain,heavy),(930,1)},9 % 1)"
"({(cloud,heavy),(rain,light),(930,1)},9 % 1)"
"({(cloud,heavy),(rain,none),(930,1)},9 % 1)"
"({(cloud,light),(rain,heavy),(930,2)},9 % 1)"
"({(cloud,light),(rain,light),(930,2)},9 % 1)"
"({(cloud,light),(rain,none),(930,2)},9 % 1)"
"({(cloud,none),(rain,heavy),(930,1)},9 % 1)"
"({(cloud,none),(rain,light),(930,1)},9 % 1)"
"({(cloud,none),(rain,none),(930,2)},9 % 1)"

Re-arranging to show the components,

"({(cloud,none),(rain,none),(930,2)},9 % 1)"
"({(cloud,light),(rain,none),(930,2)},9 % 1)"
"({(cloud,light),(rain,light),(930,2)},9 % 1)"
"({(cloud,light),(rain,heavy),(930,2)},9 % 1)"

"({(cloud,none),(rain,light),(930,1)},9 % 1)"
"({(cloud,none),(rain,heavy),(930,1)},9 % 1)"
"({(cloud,heavy),(rain,none),(930,1)},9 % 1)"
"({(cloud,heavy),(rain,light),(930,1)},9 % 1)"
"({(cloud,heavy),(rain,heavy),(930,1)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [pressure, rain, VarInt 1224]
"({(pressure,high),(rain,heavy),(1224,1)},9 % 1)"
"({(pressure,high),(rain,light),(1224,1)},9 % 1)"
"({(pressure,high),(rain,none),(1224,1)},9 % 1)"
"({(pressure,low),(rain,heavy),(1224,2)},9 % 1)"
"({(pressure,low),(rain,light),(1224,1)},9 % 1)"
"({(pressure,low),(rain,none),(1224,1)},9 % 1)"
"({(pressure,medium),(rain,heavy),(1224,1)},9 % 1)"
"({(pressure,medium),(rain,light),(1224,1)},9 % 1)"
"({(pressure,medium),(rain,none),(1224,1)},9 % 1)"

Re-arranging to show the components,

"({(pressure,high),(rain,none),(1224,1)},9 % 1)"
"({(pressure,high),(rain,light),(1224,1)},9 % 1)"
"({(pressure,high),(rain,heavy),(1224,1)},9 % 1)"
"({(pressure,medium),(rain,none),(1224,1)},9 % 1)"
"({(pressure,medium),(rain,light),(1224,1)},9 % 1)"
"({(pressure,medium),(rain,heavy),(1224,1)},9 % 1)"
"({(pressure,low),(rain,none),(1224,1)},9 % 1)"
"({(pressure,low),(rain,light),(1224,1)},9 % 1)"

"({(pressure,low),(rain,heavy),(1224,2)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ ff1) `red` [cloud, VarInt 1225]
"({(cloud,heavy),(1225,1)},27 % 1)"
"({(cloud,light),(1225,2)},27 % 1)"
"({(cloud,none),(1225,2)},27 % 1)"

rpln $ aall $ aa `fapply` ff1
"({(930,1),(931,2),(1224,1),(1225,2)},3 % 1)"
"({(930,1),(931,2),(1224,2),(1225,1)},4 % 1)"
"({(930,2),(931,1),(1224,1),(1225,2)},12 % 1)"
"({(930,2),(931,2),(1224,1),(1225,2)},1 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff1)) `divide` (norm (vvc `fapply` ff1))
"({(930,1),(931,2),(1224,1),(1225,2)},3.0375)"
"({(930,1),(931,2),(1224,2),(1225,1)},8.1)"
"({(930,2),(931,1),(1224,1),(1225,2)},2.1130434782608694)"
"({(930,2),(931,2),(1224,1),(1225,2)},0.405)"

algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
14.511656645973256

algnden (aa `fapply` ff1) - algnden (ind aa `fapply` ff1)
7.255828322986628

ent (aa `fapply` ff1)
1.0627375681569962

cent (fftt ff1) aa
1.4909439898728003

rent (aa `fapply` ff1) (vvc `fapply` ff1)
15.80977099960299

Here the example differs from the let mmax = 2 example in Decrementing maximiser because bmax / mmax == 2 and so there are two tuples to be decremented, [pressure, wind, cloud, rain] which is the underlying tuple for variables 930 and 931, and [pressure, cloud, rain] which is the underlying tuple for variables 1224 and 1225. The overall alignment valency-density is the highest so far.

Now consider the next layer let lmax = 2,

let ff2 = zzllfuds aa (ind aa) 2 (3^4) 4 4 2 (3^4) 1 !! 1

Set.size $ ffqq ff2
8

rp $ fvars ff2
"{cloud,pressure,rain,wind,930,931,1224,1225,1486,1487,1560,1561}"

rp $ fder ff2
"{1486,1487,1560,1561}"

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff2
...
"({(cloud,heavy),(931,1),(1487,1)},1 % 1)"
"({(cloud,heavy),(931,2),(1487,2)},1 % 1)"
"({(cloud,light),(931,1),(1487,1)},1 % 1)"
"({(cloud,light),(931,2),(1487,1)},1 % 1)"
"({(cloud,none),(931,1),(1487,2)},1 % 1)"
"({(cloud,none),(931,2),(1487,1)},1 % 1)"
...
"({(rain,heavy),(1224,1),(1486,1)},1 % 1)"
"({(rain,heavy),(1224,2),(1486,2)},1 % 1)"
"({(rain,light),(1224,1),(1486,1)},1 % 1)"
"({(rain,light),(1224,2),(1486,1)},1 % 1)"
"({(rain,none),(1224,1),(1486,2)},1 % 1)"
"({(rain,none),(1224,2),(1486,1)},1 % 1)"
...
"({(930,1),(1225,1),(1561,1)},1 % 1)"
"({(930,1),(1225,2),(1561,1)},1 % 1)"
"({(930,2),(1225,1),(1561,1)},1 % 1)"
"({(930,2),(1225,2),(1561,2)},1 % 1)"
"({(931,1),(1224,1),(1560,1)},1 % 1)"
"({(931,1),(1224,2),(1560,2)},1 % 1)"
"({(931,2),(1224,1),(1560,2)},1 % 1)"
"({(931,2),(1224,2),(1560,2)},1 % 1)"

algn (aa `fapply` ff2) - algn (ind aa `fapply` ff2)
9.563657382651245

algnden (aa `fapply` ff2) - algnden (ind aa `fapply` ff2)
4.7818286913256225

ent (aa `fapply` ff2)
1.6137942391528548

cent (fftt ff2) aa
0.9398873188769417

rent (aa `fapply` ff2) (vvc `fapply` ff2)
15.123697293110922

In this case, the additional layer reduces the alignment valency-density.

Now consider increasing pmax,

let ff1 = last $ zzllfuds aa (ind aa) 1 (3^4) 4 4 4 (3^4) 2

Set.size $ ffqq ff1
6

rp $ fvars ff1
"{cloud,pressure,rain,wind,278,279,352,353,354,355}"

rp $ fder ff1
"{278,279,352,353,354,355}"

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff1
"({(cloud,heavy),(278,1)},1 % 1)"
"({(cloud,light),(278,2)},1 % 1)"
"({(cloud,none),(278,3)},1 % 1)"
"({(cloud,heavy),(352,1)},1 % 1)"
"({(cloud,light),(352,2)},1 % 1)"
"({(cloud,none),(352,2)},1 % 1)"
"({(pressure,high),(354,1)},1 % 1)"
"({(pressure,low),(354,2)},1 % 1)"
"({(pressure,medium),(354,1)},1 % 1)"
"({(rain,heavy),(279,1)},1 % 1)"
"({(rain,light),(279,2)},1 % 1)"
"({(rain,none),(279,3)},1 % 1)"
"({(rain,heavy),(353,1)},1 % 1)"
"({(rain,light),(353,2)},1 % 1)"
"({(rain,none),(353,2)},1 % 1)"
"({(wind,light),(355,1)},1 % 1)"
"({(wind,none),(355,2)},1 % 1)"
"({(wind,strong),(355,1)},1 % 1)"

rpln $ aall $ aa `fapply` ff1
"({(278,1),(279,1),(352,1),(353,1),(354,2),(355,1)},4 % 1)"
"({(278,2),(279,1),(352,2),(353,1),(354,1),(355,1)},2 % 1)"
"({(278,2),(279,2),(352,2),(353,2),(354,1),(355,1)},2 % 1)"
"({(278,2),(279,2),(352,2),(353,2),(354,1),(355,2)},1 % 1)"
"({(278,2),(279,2),(352,2),(353,2),(354,2),(355,2)},1 % 1)"
"({(278,2),(279,3),(352,2),(353,2),(354,1),(355,2)},1 % 1)"
"({(278,3),(279,2),(352,2),(353,2),(354,1),(355,1)},2 % 1)"
"({(278,3),(279,2),(352,2),(353,2),(354,2),(355,1)},1 % 1)"
"({(278,3),(279,3),(352,2),(353,2),(354,1),(355,1)},2 % 1)"
"({(278,3),(279,3),(352,2),(353,2),(354,1),(355,2)},4 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff1)) `divide` (norm (vvc `fapply` ff1))
"({(278,1),(279,1),(352,1),(353,1),(354,2),(355,1)},8.1)"
"({(278,2),(279,1),(352,2),(353,1),(354,1),(355,1)},2.025)"
"({(278,2),(279,2),(352,2),(353,2),(354,1),(355,1)},2.025)"
"({(278,2),(279,2),(352,2),(353,2),(354,1),(355,2)},2.025)"
"({(278,2),(279,2),(352,2),(353,2),(354,2),(355,2)},4.05)"
"({(278,2),(279,3),(352,2),(353,2),(354,1),(355,2)},2.025)"
"({(278,3),(279,2),(352,2),(353,2),(354,1),(355,1)},2.025)"
"({(278,3),(279,2),(352,2),(353,2),(354,2),(355,1)},2.025)"
"({(278,3),(279,3),(352,2),(353,2),(354,1),(355,1)},2.025)"
"({(278,3),(279,3),(352,2),(353,2),(354,1),(355,2)},8.1)"

algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
11.54939437653613

algnden (aa `fapply` ff1) - algnden (ind aa `fapply` ff1)
5.044662653438615

ent (aa `fapply` ff1)
2.1639556568820564

cent (fftt ff1) aa
0.38972590114773975

rent (aa `fapply` ff1) (vvc `fapply` ff1)
20.232713267033432

This optimisation has the highest relative entropy, but not the highest alignment valency-density because it is a mixture of the mmax == 4 and mmax == 3 cases.

Now consider increasing pmax and bmax,

let ff1 = last $ zzllfuds aa (ind aa) 1 (3^4) 4 (4*2) 4 (3^4) 3

Set.size $ ffqq ff1
6

rp $ fvars ff1
"{cloud,pressure,rain,wind,278,279,355,514,515,516}"

rp $ fder ff1
"{278,279,355,514,515,516}"

algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
11.54939437653613

This case is unchanged from the previous optimisation.

Now consider predicting the rain,

let ff1 = last $ zzllfuds (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 1 (3^3) 3 3 3 (3^3) 1


Set.size $ ffqq ff1
3

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff1
"({(cloud,heavy),(64,1)},1 % 1)"
"({(cloud,light),(64,2)},1 % 1)"
"({(cloud,none),(64,2)},1 % 1)"
"({(pressure,high),(66,1)},1 % 1)"
"({(pressure,low),(66,2)},1 % 1)"
"({(pressure,medium),(66,1)},1 % 1)"
"({(wind,light),(65,1)},1 % 1)"
"({(wind,none),(65,1)},1 % 1)"
"({(wind,strong),(65,2)},1 % 1)"

rpln $ aall $ aa `fapply` ff1
"({(64,1),(65,1),(66,2)},2 % 1)"
"({(64,1),(65,2),(66,2)},2 % 1)"
"({(64,2),(65,1),(66,1)},12 % 1)"
"({(64,2),(65,1),(66,2)},2 % 1)"
"({(64,2),(65,2),(66,1)},2 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff1)) `divide` (norm (vvc `fapply` ff1))
"({(64,1),(65,1),(66,2)},1.35)"
"({(64,1),(65,2),(66,2)},2.7)"
"({(64,2),(65,1),(66,1)},2.025)"
"({(64,2),(65,1),(66,2)},0.675)"
"({(64,2),(65,2),(66,1)},0.675)"

algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
5.502378302548841

algnden (aa `fapply` ff1) - algnden (ind aa `fapply` ff1)
2.7511891512744207

ent (aa `fapply` ff1)
1.2275294114572126

cent (fftt ff1) (aa `red` [cloud,pressure,wind])
1.256837428516589

rent (aa `fapply` ff1) (vvc `fapply` ff1)
8.000638738734352

tlalgn (fftt ff1) aa [rain]
9.542774419869675

tlent (fftt ff1) aa [rain]
12.038625670709138

size $ eff (aa `fapply` ff1) `mul` (vvc `fapply` ff1)
57 % 1


let ff2 = last $ zzllfuds (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 2 (3^3) 3 3 3 (3^3) 1


Set.size $ ffqq ff2
4

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff2
"({(cloud,heavy),(64,1)},1 % 1)"
"({(cloud,light),(64,2)},1 % 1)"
"({(cloud,none),(64,2)},1 % 1)"
"({(pressure,high),(66,1)},1 % 1)"
"({(pressure,low),(66,2)},1 % 1)"
"({(pressure,medium),(66,1)},1 % 1)"
"({(wind,light),(65,1)},1 % 1)"
"({(wind,none),(65,1)},1 % 1)"
"({(wind,strong),(65,2)},1 % 1)"
"({(66,1),(102,1)},1 % 1)"
"({(66,2),(102,2)},1 % 1)"

algn (aa `fapply` ff2) - algn (ind aa `fapply` ff2)
5.502378302548841

algn (aa `fapply` ff2) - algn (ind aa `fapply` ff2) == algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
True

Here the addition of the variable 102 in the second layer is redundant.

Now impose the constraint let mmax = 2,

let ff1 = last $ zzllfuds (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 1 (3^3) 3 3 2 (3^3) 1


Set.size $ ffqq ff1
2

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff1
"({(cloud,heavy),(296,1)},1 % 1)"
"({(cloud,light),(296,2)},1 % 1)"
"({(cloud,none),(296,2)},1 % 1)"
"({(pressure,high),(wind,light),(297,1)},1 % 1)"
"({(pressure,high),(wind,none),(297,1)},1 % 1)"
"({(pressure,high),(wind,strong),(297,1)},1 % 1)"
"({(pressure,low),(wind,light),(297,2)},1 % 1)"
"({(pressure,low),(wind,none),(297,1)},1 % 1)"
"({(pressure,low),(wind,strong),(297,2)},1 % 1)"
"({(pressure,medium),(wind,light),(297,1)},1 % 1)"
"({(pressure,medium),(wind,none),(297,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(297,1)},1 % 1)"

rpln $ aall $ aa `fapply` ff1
"({(296,1),(297,2)},4 % 1)"
"({(296,2),(297,1)},15 % 1)"
"({(296,2),(297,2)},1 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff1)) `divide` (norm (vvc `fapply` ff1))
"({(296,1),(297,2)},2.7)"
"({(296,2),(297,1)},1.4464285714285714)"
"({(296,2),(297,2)},0.3375)"

algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
6.120297420629477

algnden (aa `fapply` ff1) - algnden (ind aa `fapply` ff1)
3.0601487103147385

ent (aa `fapply` ff1)
0.6874357505033553

cent (fftt ff1) (aa `red` [cloud,pressure,wind])
1.7969310894704469

rent (aa `fapply` ff1) (vvc `fapply` ff1)
7.155521399648592

tlalgn (fftt ff1) aa [rain]
9.21757669489453

tlent (fftt ff1) aa [rain]
14.862530796657737

size $ eff (aa `fapply` ff1) `mul` (vvc `fapply` ff1)
60 % 1


let ff2 = last $ zzllfuds (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 2 (3^3) 3 3 2 (3^3) 1


Set.size $ ffqq ff2
3

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff2
"({(cloud,heavy),(296,1)},1 % 1)"
"({(cloud,light),(296,2)},1 % 1)"
"({(cloud,none),(296,2)},1 % 1)"
"({(pressure,high),(wind,light),(297,1)},1 % 1)"
"({(pressure,high),(wind,none),(297,1)},1 % 1)"
"({(pressure,high),(wind,strong),(297,1)},1 % 1)"
"({(pressure,low),(wind,light),(297,2)},1 % 1)"
"({(pressure,low),(wind,none),(297,1)},1 % 1)"
"({(pressure,low),(wind,strong),(297,2)},1 % 1)"
"({(pressure,medium),(wind,light),(297,1)},1 % 1)"
"({(pressure,medium),(wind,none),(297,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(297,1)},1 % 1)"
"({(pressure,high),(297,1),(401,1)},1 % 1)"
"({(pressure,high),(297,2),(401,1)},1 % 1)"
"({(pressure,low),(297,1),(401,1)},1 % 1)"
"({(pressure,low),(297,2),(401,2)},1 % 1)"
"({(pressure,medium),(297,1),(401,1)},1 % 1)"
"({(pressure,medium),(297,2),(401,1)},1 % 1)"

algn (aa `fapply` ff2) - algn (ind aa `fapply` ff2)
6.120297420629477

algn (aa `fapply` ff2) - algn (ind aa `fapply` ff2) == algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
True

Here the addition of the variable 401 in the second layer is redundant.

Now consider increasing bmax and pmax,

let ff1 = last $ zzllfuds (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 1 (3^3) 3 (3*2) 3 (3^3) 2


Set.size $ ffqq ff1
4

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff1
"({(cloud,heavy),(197,1)},1 % 1)"
"({(cloud,light),(197,2)},1 % 1)"
"({(cloud,none),(197,2)},1 % 1)"
"({(pressure,high),(196,1)},1 % 1)"
"({(pressure,low),(196,2)},1 % 1)"
"({(pressure,medium),(196,1)},1 % 1)"
"({(wind,light),(161,1)},1 % 1)"
"({(wind,none),(161,1)},1 % 1)"
"({(wind,strong),(161,2)},1 % 1)"
"({(wind,light),(171,1)},1 % 1)"
"({(wind,none),(171,2)},1 % 1)"
"({(wind,strong),(171,1)},1 % 1)"

rpln $ aall $ aa `fapply` ff1
"({(161,1),(171,1),(196,1),(197,2)},6 % 1)"
"({(161,1),(171,1),(196,2),(197,1)},2 % 1)"
"({(161,1),(171,1),(196,2),(197,2)},1 % 1)"
"({(161,1),(171,2),(196,1),(197,2)},6 % 1)"
"({(161,1),(171,2),(196,2),(197,2)},1 % 1)"
"({(161,2),(171,1),(196,1),(197,2)},2 % 1)"
"({(161,2),(171,1),(196,2),(197,1)},2 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff1)) `divide` (norm (vvc `fapply` ff1))
"({(161,1),(171,1),(196,1),(197,2)},2.025)"
"({(161,1),(171,1),(196,2),(197,1)},2.7)"
"({(161,1),(171,1),(196,2),(197,2)},0.675)"
"({(161,1),(171,2),(196,1),(197,2)},2.025)"
"({(161,1),(171,2),(196,2),(197,2)},0.675)"
"({(161,2),(171,1),(196,1),(197,2)},0.675)"
"({(161,2),(171,1),(196,2),(197,1)},2.7)"

algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
5.479604642160737

algnden (aa `fapply` ff1) - algnden (ind aa `fapply` ff1)
2.7398023210803686

ent (aa `fapply` ff1)
1.7127324378491742

cent (fftt ff1) (aa `red` [cloud,pressure,wind])
0.7716344021246275

rent (aa `fapply` ff1) (vvc `fapply` ff1)
9.134261560638578

tlalgn (fftt ff1) aa [rain]
9.796885794022508

tlent (fftt ff1) aa [rain]
10.158087202561829

size $ eff (aa `fapply` ff1) `mul` (vvc `fapply` ff1)
54 % 1

Of the optimised predictive models this has the highest relative entropy and the lowest label entropy, but it is the least query effective. It does not have the highest alignment density, however, which is obtained by constraining mmax.

Now restrict mmax again,

let ff1 = last $ zzllfuds (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 1 (3^3) 3 (3*2) 2 (3^3) 2


Set.size $ ffqq ff1
7

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff1
"({(cloud,heavy),(607,1)},1 % 1)"
"({(cloud,light),(607,2)},1 % 1)"
"({(cloud,none),(607,2)},1 % 1)"
"({(cloud,heavy),(614,1)},1 % 1)"
"({(cloud,light),(614,2)},1 % 1)"
"({(cloud,none),(614,3)},1 % 1)"
"({(cloud,heavy),(631,1)},1 % 1)"
"({(cloud,light),(631,1)},1 % 1)"
"({(cloud,none),(631,2)},1 % 1)"
"({(pressure,high),(wind,light),(577,1)},1 % 1)"
"({(pressure,high),(wind,none),(577,1)},1 % 1)"
"({(pressure,high),(wind,strong),(577,1)},1 % 1)"
"({(pressure,low),(wind,light),(577,2)},1 % 1)"
"({(pressure,low),(wind,none),(577,1)},1 % 1)"
"({(pressure,low),(wind,strong),(577,2)},1 % 1)"
"({(pressure,medium),(wind,light),(577,1)},1 % 1)"
"({(pressure,medium),(wind,none),(577,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(577,1)},1 % 1)"
"({(pressure,high),(606,1)},1 % 1)"
"({(pressure,low),(606,2)},1 % 1)"
"({(pressure,medium),(606,1)},1 % 1)"
"({(wind,light),(615,1)},1 % 1)"
"({(wind,none),(615,2)},1 % 1)"
"({(wind,strong),(615,3)},1 % 1)"
"({(wind,light),(630,1)},1 % 1)"
"({(wind,none),(630,1)},1 % 1)"
"({(wind,strong),(630,2)},1 % 1)"

rpln $ aall $ aa `fapply` ff1
"({(577,1),(606,1),(607,2),(614,2),(615,1),(630,1),(631,1)},2 % 1)"
"({(577,1),(606,1),(607,2),(614,2),(615,2),(630,1),(631,1)},2 % 1)"
"({(577,1),(606,1),(607,2),(614,2),(615,3),(630,2),(631,1)},2 % 1)"
"({(577,1),(606,1),(607,2),(614,3),(615,1),(630,1),(631,2)},4 % 1)"
"({(577,1),(606,1),(607,2),(614,3),(615,2),(630,1),(631,2)},4 % 1)"
"({(577,1),(606,2),(607,2),(614,2),(615,2),(630,1),(631,1)},1 % 1)"
"({(577,2),(606,2),(607,1),(614,1),(615,1),(630,1),(631,1)},2 % 1)"
"({(577,2),(606,2),(607,1),(614,1),(615,3),(630,2),(631,1)},2 % 1)"
"({(577,2),(606,2),(607,2),(614,3),(615,1),(630,1),(631,2)},1 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff1)) `divide` (norm (vvc `fapply` ff1))
"({(577,1),(606,1),(607,2),(614,2),(615,1),(630,1),(631,1)},1.35)"
"({(577,1),(606,1),(607,2),(614,2),(615,2),(630,1),(631,1)},1.35)"
"({(577,1),(606,1),(607,2),(614,2),(615,3),(630,2),(631,1)},1.35)"
"({(577,1),(606,1),(607,2),(614,3),(615,1),(630,1),(631,2)},2.7)"
"({(577,1),(606,1),(607,2),(614,3),(615,2),(630,1),(631,2)},2.7)"
"({(577,1),(606,2),(607,2),(614,2),(615,2),(630,1),(631,1)},1.35)"
"({(577,2),(606,2),(607,1),(614,1),(615,1),(630,1),(631,1)},2.7)"
"({(577,2),(606,2),(607,1),(614,1),(615,3),(630,2),(631,1)},2.7)"
"({(577,2),(606,2),(607,2),(614,3),(615,1),(630,1),(631,2)},1.35)"

algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
6.7409115941524185

algnden (aa `fapply` ff1) - algnden (ind aa `fapply` ff1)
3.0017660921327414

ent (aa `fapply` ff1)
2.0946409388260623

cent (fftt ff1) (aa `red` [cloud,pressure,wind])
0.38972590114773975

rent (aa `fapply` ff1) (vvc `fapply` ff1)
12.0770705633403

tlalgn (fftt ff1) aa [rain]
16.325738539409134

tlent (fftt ff1) aa [rain]
6.931471805599452

size $ eff (aa `fapply` ff1) `mul` (vvc `fapply` ff1)
42 % 1

It is clear that a more sophisticated management of the tuple partitions has the potential to increase the optimisation in some cases. This is achieved in the maximum-roll-by-derived-dimension fud tree searcher below.

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

Highest-layer limited-layer limited-underlying limited-breadth fud tree searcher

Define the highest-layer limited-layer limited-underlying limited-breadth fud tree searcher (Text) \[ Z_{P,A,A_R,\mathrm{L,d}} = \mathrm{searchTreer}(\mathcal{F}_{\infty,U_A,V_A} \cap \mathcal{F}_{\mathrm{u}} \cap \mathcal{F}_{\mathrm{b}} \cap \mathcal{F}_{\mathrm{h}},P_{P,A,A_R,\mathrm{L,d}},\{\emptyset\}) \] where the neighbourhood function returns a singleton \[ \begin{eqnarray} &&P_{P,A,A_R,\mathrm{L,d}}(F) = \{G : \\ &&\hspace{2em}G \in P_{P,A,A_R,\mathrm{L}}(F),\\ &&\hspace{2em}(F \neq \emptyset \implies ~\mathrm{maxr}(\mathrm{el}(Z_{P,A,A_R,F,\mathrm{D,d}})) < \mathrm{maxr}(\mathrm{el}(Z_{P,A,A_R,G,\mathrm{D,d}})))\} \end{eqnarray} \] where $\mathrm{el} = \mathrm{elements}$.

The fud tree search function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesSearcherFudHighest :: 
  Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> 
  System -> Histogram -> Histogram ->
  Maybe [Fud]

as

parametersSystemsSamplesShufflesSearcherFudHighest wmax lmax xmax omax bmax mmax umax pmax uu aa aarr
  ...
  | ... = Just $ ls uu fudEmpty lmax 0
  | otherwise = Nothing
  where
    ls _ _ 0 _ = []
    ls uu ff h a = if b > a then (gg : ls uu' gg (h-1) b) else []
      where
        gg = ff `funion` llff [(pptt . ttpp . fftt) (depends (fexplode hh) w) | 
               kk <- topff (bmax `div` mmax) ff (zzffcstupopt xmax omax uu aa aarr ff), 
               hh <- top pmax (zzcsddecoptw mmax umax pmax uu aa aarr ff kk), w <- qqll (fder hh)]
        uu' = uu `uunion` fsys gg
        b = maxr $ zzffcsdderopt wmax omax uu' aa aarr gg
    zzffcstupopt xmax omax uu aa aarr ff = fst $ unzip $ fromJust $ 
      parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple xmax omax uu aa aarr ff
    zzcsddecoptw mmax umax pmax uu aa aarr ff kk = fst $ unzip $ fromJust $
      parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementingLimitedValency 
        mmax umax pmax uu aa aarr ff kk
    zzffcsdderopt wmax omax uu aa rr ff = fst $ unzip $ fromJust $ 
      parametersSystemsSamplesShufflesFudsFunctionOptimiserDerivedHighest wmax omax uu aa rr ff
    ...

Note that this implementation is additionally constrained to be limited-valency.

An implementation with the partition variables replaced by cardinal variables has an additional argument of a list of variables, [Variable]. It is also defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesListVariablesSearcherFudHighest :: 
  Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> 
  System -> Histogram -> Histogram -> [Variable] ->
  Maybe ([Fud],(System,[Variable]))

as

parametersSystemsSamplesShufflesListVariablesSearcherFudHighest wmax lmax xmax omax bmax mmax umax pmax uu aa aarr ll
  ...
  | ... = Just $ (pp,(uu',ll'))
  | otherwise = Nothing
  where
    qq = ls fudEmpty uu ll lmax 0
    pp = fst $ unzip $ qq
    (uu',ll') = if qq /= [] then (last $ snd $ unzip qq) else (uu,ll)
    ls _ _ _ 0 _ = []
    ls ff uu ll h a = if b > a then ((gg,(uu',ll')) : ls gg uu' ll' (h-1) b) else []
      where
        yy = ls2 (topff (bmax `div` mmax) ff (zzffcstupopt xmax omax uu aa aarr ff)) uu ll
        gg = ff `funion` llff (elems (llmm [(rr, tt) | hh <- (concat $ fst $ unzip yy), 
                                             w <- qqll (fder hh), let tt = fftt (depends hh w), 
                                             let rr = ttpp tt, rr `notmem` nn]))
        (uu',ll') = if yy /= [] then (last $ snd $ unzip yy) else (uu,ll)
        b = maxr $ zzffcsdderhighopt wmax omax uu' aa aarr gg
        nn = llqq [ttpp tt | tt <- (qqll . ffqq) ff]
        ls2 [] _ _ = []
        ls2 (kk:bb) uu ll = (top pmax (fst $ unzip xx),(uu',ll')) : ls2 bb uu' ll'
          where
            (xx,(uu',ll')) = zzllcsddecoptw mmax umax pmax uu aa aarr ff kk ll
    zzffcstupopt xmax omax uu aa aarr ff = fst $ unzip $ fromJust $ 
      parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple xmax omax uu aa aarr ff
    zzllcsddecoptw mmax umax pmax uu aa aarr ff kk ll = fromJust $
      parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionOptimiserFudDecrementingLimitedValency 
        mmax umax pmax uu aa aarr ff kk ll
    zzffcsdderhighopt wmax omax uu aa rr ff = fst $ unzip $ fromJust $ 
      parametersSystemsSamplesShufflesFudsFunctionOptimiserDerivedHighest wmax omax uu aa rr ff
    ...

For example,

let zzllfuds aa aarr lmax xmax omax bmax mmax umax pmax = fst $ fromJust $ parametersSystemsSamplesShufflesListVariablesSearcherFud lmax xmax omax bmax mmax umax pmax (sys aa) aa aarr [VarInt i | i <-[10..]]

let zzllfudshigh aa aarr lmax xmax omax bmax mmax umax pmax = fst $ fromJust $ parametersSystemsSamplesShufflesListVariablesSearcherFudHighest xmax lmax xmax omax bmax mmax umax pmax (sys aa) aa aarr [VarInt i | i <-[10..]]


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

rpln $ zzllfuds aa (ind aa) 2 (3^3) 3 3 3 (3^3) 1
"{({({(1,1),(24,1)},1 % 1),({(1,2),(24,2)},1 % 1),({(1,3),(24,2)},1 % 1)},{24}),({({(2,1),(25,1)},1 % 1),({(2,2),(25,2)},1 % 1),({(2,3),(25,2)},1 % 1)},{25})}"
"{({({(1,1),(24,1)},1 % 1),({(1,2),(24,2)},1 % 1),({(1,3),(24,2)},1 % 1)},{24}),({({(2,1),(25,1)},1 % 1),({(2,2),(25,2)},1 % 1),({(2,3),(25,2)},1 % 1)},{25}),({({(24,1),(30,1)},1 % 1),({(24,2),(30,2)},1 % 1)},{30}),({({(25,1),(31,1)},1 % 1),({(25,2),(31,2)},1 % 1)},{31})}"

rpln $ zzllfudshigh aa (ind aa) 2 (3^3) 3 3 3 (3^3) 1
"{({({(1,1),(24,1)},1 % 1),({(1,2),(24,2)},1 % 1),({(1,3),(24,2)},1 % 1)},{24}),({({(2,1),(25,1)},1 % 1),({(2,2),(25,2)},1 % 1),({(2,3),(25,2)},1 % 1)},{25})}"


rpln $ zzllfuds aa (ind aa) 2 (3^4) 3 3 3 (3^4) 1
"{({({(1,1),(625,1)},1 % 1),({(1,2),(625,2)},1 % 1),({(1,3),(625,2)},1 % 1)},{625}),({({(2,1),(4,1),(624,1)},1 % 1),({(2,1),(4,2),(624,1)},1 % 1),({(2,1),(4,3),(624,1)},1 % 1),({(2,2),(4,1),(624,2)},1 % 1),({(2,2),(4,2),(624,3)},1 % 1),({(2,2),(4,3),(624,3)},1 % 1),({(2,3),(4,1),(624,2)},1 % 1),({(2,3),(4,2),(624,3)},1 % 1),({(2,3),(4,3),(624,3)},1 % 1)},{624}),({({(3,1),(626,1)},1 % 1),({(3,2),(626,2)},1 % 1),({(3,3),(626,2)},1 % 1)},{626})}"
"{({({(1,1),(625,1)},1 % 1),({(1,2),(625,2)},1 % 1),({(1,3),(625,2)},1 % 1)},{625}),({({(2,1),(4,1),(624,1)},1 % 1),({(2,1),(4,2),(624,1)},1 % 1),({(2,1),(4,3),(624,1)},1 % 1),({(2,2),(4,1),(624,2)},1 % 1),({(2,2),(4,2),(624,3)},1 % 1),({(2,2),(4,3),(624,3)},1 % 1),({(2,3),(4,1),(624,2)},1 % 1),({(2,3),(4,2),(624,3)},1 % 1),({(2,3),(4,3),(624,3)},1 % 1)},{624}),({({(3,1),(626,1)},1 % 1),({(3,2),(626,2)},1 % 1),({(3,3),(626,2)},1 % 1)},{626}),({({(4,1),(748,1)},1 % 1),({(4,2),(748,2)},1 % 1),({(4,3),(748,2)},1 % 1)},{748}),({({(624,1),(747,1)},1 % 1),({(624,2),(747,2)},1 % 1),({(624,3),(747,2)},1 % 1)},{747}),({({(625,1),(626,1),(746,1)},1 % 1),({(625,1),(626,2),(746,1)},1 % 1),({(625,2),(626,1),(746,2)},1 % 1),({(625,2),(626,2),(746,3)},1 % 1)},{746})}"

rpln $ zzllfudshigh aa (ind aa) 2 (3^4) 3 3 3 (3^4) 1
"{({({(1,1),(625,1)},1 % 1),({(1,2),(625,2)},1 % 1),({(1,3),(625,2)},1 % 1)},{625}),({({(2,1),(4,1),(624,1)},1 % 1),({(2,1),(4,2),(624,1)},1 % 1),({(2,1),(4,3),(624,1)},1 % 1),({(2,2),(4,1),(624,2)},1 % 1),({(2,2),(4,2),(624,3)},1 % 1),({(2,2),(4,3),(624,3)},1 % 1),({(2,3),(4,1),(624,2)},1 % 1),({(2,3),(4,2),(624,3)},1 % 1),({(2,3),(4,3),(624,3)},1 % 1)},{624}),({({(3,1),(626,1)},1 % 1),({(3,2),(626,2)},1 % 1),({(3,3),(626,2)},1 % 1)},{626})}"
"{({({(1,1),(625,1)},1 % 1),({(1,2),(625,2)},1 % 1),({(1,3),(625,2)},1 % 1)},{625}),({({(2,1),(4,1),(624,1)},1 % 1),({(2,1),(4,2),(624,1)},1 % 1),({(2,1),(4,3),(624,1)},1 % 1),({(2,2),(4,1),(624,2)},1 % 1),({(2,2),(4,2),(624,3)},1 % 1),({(2,2),(4,3),(624,3)},1 % 1),({(2,3),(4,1),(624,2)},1 % 1),({(2,3),(4,2),(624,3)},1 % 1),({(2,3),(4,3),(624,3)},1 % 1)},{624}),({({(3,1),(626,1)},1 % 1),({(3,2),(626,2)},1 % 1),({(3,3),(626,2)},1 % 1)},{626}),({({(4,1),(748,1)},1 % 1),({(4,2),(748,2)},1 % 1),({(4,3),(748,2)},1 % 1)},{748}),({({(624,1),(747,1)},1 % 1),({(624,2),(747,2)},1 % 1),({(624,3),(747,2)},1 % 1)},{747}),({({(625,1),(626,1),(746,1)},1 % 1),({(625,1),(626,2),(746,1)},1 % 1),({(625,2),(626,1),(746,2)},1 % 1),({(625,2),(626,2),(746,3)},1 % 1)},{746})}"

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

let aa = hhaa hh

let ff = last $ zzllfuds aa (ind aa) 2 (3^4) 4 4 4 (3^4) 1

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff
"({(cloud,heavy),(108,1)},1 % 1)"
"({(cloud,light),(108,2)},1 % 1)"
"({(cloud,none),(108,3)},1 % 1)"
"({(pressure,high),(106,1)},1 % 1)"
"({(pressure,low),(106,2)},1 % 1)"
"({(pressure,medium),(106,2)},1 % 1)"
"({(rain,heavy),(109,1)},1 % 1)"
"({(rain,light),(109,2)},1 % 1)"
"({(rain,none),(109,3)},1 % 1)"
"({(wind,light),(107,1)},1 % 1)"
"({(wind,none),(107,1)},1 % 1)"
"({(wind,strong),(107,2)},1 % 1)"
"({(107,1),(216,1)},1 % 1)"
"({(107,2),(216,2)},1 % 1)"
"({(109,1),(217,1)},1 % 1)"
"({(109,2),(217,2)},1 % 1)"
"({(109,3),(217,3)},1 % 1)"

algnden (aa `fapply` ff) - algnden (ind aa `fapply` ff)
4.535768164237375

let ff = last $ zzllfudshigh aa (ind aa) 2 (3^4) 4 4 4 (3^4) 1

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff
"({(cloud,heavy),(108,1)},1 % 1)"
"({(cloud,light),(108,2)},1 % 1)"
"({(cloud,none),(108,3)},1 % 1)"
"({(pressure,high),(106,1)},1 % 1)"
"({(pressure,low),(106,2)},1 % 1)"
"({(pressure,medium),(106,2)},1 % 1)"
"({(rain,heavy),(109,1)},1 % 1)"
"({(rain,light),(109,2)},1 % 1)"
"({(rain,none),(109,3)},1 % 1)"
"({(wind,light),(107,1)},1 % 1)"
"({(wind,none),(107,1)},1 % 1)"
"({(wind,strong),(107,2)},1 % 1)"

algnden (aa `fapply` ff) - algnden (ind aa `fapply` ff)
4.535768164237375

let ff = last $ zzllfuds aa (ind aa) 2 (3^4) 4 4 3 (3^4) 1

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff
"({(cloud,heavy),(543,1)},1 % 1)"
"({(cloud,light),(543,2)},1 % 1)"
"({(cloud,none),(543,2)},1 % 1)"
"({(pressure,high),(wind,light),(544,1)},1 % 1)"
"({(pressure,high),(wind,none),(544,1)},1 % 1)"
"({(pressure,high),(wind,strong),(544,1)},1 % 1)"
"({(pressure,low),(wind,light),(544,2)},1 % 1)"
"({(pressure,low),(wind,none),(544,1)},1 % 1)"
"({(pressure,low),(wind,strong),(544,2)},1 % 1)"
"({(pressure,medium),(wind,light),(544,1)},1 % 1)"
"({(pressure,medium),(wind,none),(544,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(544,1)},1 % 1)"
"({(pressure,high),(544,1),(778,1)},1 % 1)"
"({(pressure,high),(544,2),(778,1)},1 % 1)"
"({(pressure,low),(544,1),(778,1)},1 % 1)"
"({(pressure,low),(544,2),(778,2)},1 % 1)"
"({(pressure,medium),(544,1),(778,1)},1 % 1)"
"({(pressure,medium),(544,2),(778,1)},1 % 1)"
"({(rain,heavy),(545,1)},1 % 1)"
"({(rain,light),(545,2)},1 % 1)"
"({(rain,none),(545,2)},1 % 1)"

algnden (aa `fapply` ff) - algnden (ind aa `fapply` ff)
5.08585653022679

let ff = last $ zzllfudshigh aa (ind aa) 2 (3^4) 4 4 3 (3^4) 1

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff
"({(cloud,heavy),(543,1)},1 % 1)"
"({(cloud,light),(543,2)},1 % 1)"
"({(cloud,none),(543,2)},1 % 1)"
"({(pressure,high),(wind,light),(544,1)},1 % 1)"
"({(pressure,high),(wind,none),(544,1)},1 % 1)"
"({(pressure,high),(wind,strong),(544,1)},1 % 1)"
"({(pressure,low),(wind,light),(544,2)},1 % 1)"
"({(pressure,low),(wind,none),(544,1)},1 % 1)"
"({(pressure,low),(wind,strong),(544,2)},1 % 1)"
"({(pressure,medium),(wind,light),(544,1)},1 % 1)"
"({(pressure,medium),(wind,none),(544,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(544,1)},1 % 1)"
"({(rain,heavy),(545,1)},1 % 1)"
"({(rain,light),(545,2)},1 % 1)"
"({(rain,none),(545,2)},1 % 1)"

algnden (aa `fapply` ff) - algnden (ind aa `fapply` ff)
5.08585653022679

let ff = last $ zzllfuds aa (ind aa) 2 (3^4) 4 4 2 (3^4) 1

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff
"({(cloud,heavy),(rain,heavy),(930,1)},1 % 1)"
"({(cloud,heavy),(rain,light),(930,1)},1 % 1)"
"({(cloud,heavy),(rain,none),(930,1)},1 % 1)"
"({(cloud,light),(rain,heavy),(930,2)},1 % 1)"
"({(cloud,light),(rain,light),(930,2)},1 % 1)"
"({(cloud,light),(rain,none),(930,2)},1 % 1)"
"({(cloud,none),(rain,heavy),(930,1)},1 % 1)"
"({(cloud,none),(rain,light),(930,1)},1 % 1)"
"({(cloud,none),(rain,none),(930,2)},1 % 1)"
"({(cloud,heavy),(931,1),(1487,1)},1 % 1)"
"({(cloud,heavy),(931,2),(1487,2)},1 % 1)"
"({(cloud,light),(931,1),(1487,1)},1 % 1)"
"({(cloud,light),(931,2),(1487,1)},1 % 1)"
"({(cloud,none),(931,1),(1487,2)},1 % 1)"
"({(cloud,none),(931,2),(1487,1)},1 % 1)"
"({(cloud,heavy),(1225,1)},1 % 1)"
"({(cloud,light),(1225,2)},1 % 1)"
"({(cloud,none),(1225,2)},1 % 1)"
"({(pressure,high),(rain,heavy),(1224,1)},1 % 1)"
"({(pressure,high),(rain,light),(1224,1)},1 % 1)"
"({(pressure,high),(rain,none),(1224,1)},1 % 1)"
"({(pressure,low),(rain,heavy),(1224,2)},1 % 1)"
"({(pressure,low),(rain,light),(1224,1)},1 % 1)"
"({(pressure,low),(rain,none),(1224,1)},1 % 1)"
"({(pressure,medium),(rain,heavy),(1224,1)},1 % 1)"
"({(pressure,medium),(rain,light),(1224,1)},1 % 1)"
"({(pressure,medium),(rain,none),(1224,1)},1 % 1)"
"({(pressure,high),(wind,light),(931,1)},1 % 1)"
"({(pressure,high),(wind,none),(931,1)},1 % 1)"
"({(pressure,high),(wind,strong),(931,1)},1 % 1)"
"({(pressure,low),(wind,light),(931,2)},1 % 1)"
"({(pressure,low),(wind,none),(931,1)},1 % 1)"
"({(pressure,low),(wind,strong),(931,2)},1 % 1)"
"({(pressure,medium),(wind,light),(931,2)},1 % 1)"
"({(pressure,medium),(wind,none),(931,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(931,1)},1 % 1)"
"({(rain,heavy),(1224,1),(1486,1)},1 % 1)"
"({(rain,heavy),(1224,2),(1486,2)},1 % 1)"
"({(rain,light),(1224,1),(1486,1)},1 % 1)"
"({(rain,light),(1224,2),(1486,1)},1 % 1)"
"({(rain,none),(1224,1),(1486,2)},1 % 1)"
"({(rain,none),(1224,2),(1486,1)},1 % 1)"
"({(930,1),(1225,1),(1561,1)},1 % 1)"
"({(930,1),(1225,2),(1561,1)},1 % 1)"
"({(930,2),(1225,1),(1561,1)},1 % 1)"
"({(930,2),(1225,2),(1561,2)},1 % 1)"
"({(931,1),(1224,1),(1560,1)},1 % 1)"
"({(931,1),(1224,2),(1560,2)},1 % 1)"
"({(931,2),(1224,1),(1560,2)},1 % 1)"
"({(931,2),(1224,2),(1560,2)},1 % 1)"

algnden (aa `fapply` ff) - algnden (ind aa `fapply` ff)
4.7818286913256225

let ff = last $ zzllfudshigh aa (ind aa) 2 (3^4) 4 4 2 (3^4) 1

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff
"({(cloud,heavy),(rain,heavy),(930,1)},1 % 1)"
"({(cloud,heavy),(rain,light),(930,1)},1 % 1)"
"({(cloud,heavy),(rain,none),(930,1)},1 % 1)"
"({(cloud,light),(rain,heavy),(930,2)},1 % 1)"
"({(cloud,light),(rain,light),(930,2)},1 % 1)"
"({(cloud,light),(rain,none),(930,2)},1 % 1)"
"({(cloud,none),(rain,heavy),(930,1)},1 % 1)"
"({(cloud,none),(rain,light),(930,1)},1 % 1)"
"({(cloud,none),(rain,none),(930,2)},1 % 1)"
"({(cloud,heavy),(1225,1)},1 % 1)"
"({(cloud,light),(1225,2)},1 % 1)"
"({(cloud,none),(1225,2)},1 % 1)"
"({(pressure,high),(rain,heavy),(1224,1)},1 % 1)"
"({(pressure,high),(rain,light),(1224,1)},1 % 1)"
"({(pressure,high),(rain,none),(1224,1)},1 % 1)"
"({(pressure,low),(rain,heavy),(1224,2)},1 % 1)"
"({(pressure,low),(rain,light),(1224,1)},1 % 1)"
"({(pressure,low),(rain,none),(1224,1)},1 % 1)"
"({(pressure,medium),(rain,heavy),(1224,1)},1 % 1)"
"({(pressure,medium),(rain,light),(1224,1)},1 % 1)"
"({(pressure,medium),(rain,none),(1224,1)},1 % 1)"
"({(pressure,high),(wind,light),(931,1)},1 % 1)"
"({(pressure,high),(wind,none),(931,1)},1 % 1)"
"({(pressure,high),(wind,strong),(931,1)},1 % 1)"
"({(pressure,low),(wind,light),(931,2)},1 % 1)"
"({(pressure,low),(wind,none),(931,1)},1 % 1)"
"({(pressure,low),(wind,strong),(931,2)},1 % 1)"
"({(pressure,medium),(wind,light),(931,2)},1 % 1)"
"({(pressure,medium),(wind,none),(931,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(931,1)},1 % 1)"

algnden (aa `fapply` ff) - algnden (ind aa `fapply` ff)
7.255828322986628

The weather forecast example continues in Maximum-roll-by-derived-dimension limited-layer limited-underlying limited-breadth fud tree searcher.

Maximum-roll-by-derived-dimension limited-layer limited-underlying limited-breadth fud tree searcher

Define the maximum-roll-by-derived-dimension limited-layer limited-underlying limited-breadth fud tree searcher (Text) \[ Z_{P,A,A_R,\mathrm{L,mm}} = \mathrm{searchTreer}(\mathcal{F}_{\infty,U_A,V_A} \cap \mathcal{F}_{\mathrm{u}} \cap \mathcal{F}_{\mathrm{b}} \cap \mathcal{F}_{\mathrm{h}},P_{P,A,A_R,\mathrm{L,mm}},\{\emptyset\}) \] where the neighbourhood function returns a singleton \[ \begin{eqnarray} &&P_{P,A,A_R,\mathrm{L,mm}}(F) = \{G :\\ &&\hspace{2em}G = F \cup \{T : K \in \mathrm{topd}(\lfloor\mathrm{bmax}/\mathrm{mmax}\rfloor)(\mathrm{elements}(Z_{P,A,A_R,F,\mathrm{B}})),\\ &&\hspace{5em}H \in \bigcup \{\mathrm{maxd}(\mathrm{set}(L)) : L \in \mathrm{paths}(\mathrm{tree}(Z_{P,A,A_R,F,\mathrm{n},-,K,\mathrm{mm}}))\},\\ &&\hspace{5em}w \in \mathrm{der}(H),~I = \mathrm{depends}(\mathrm{explode}(H),\{w\}),~T = I^{\mathrm{TPT}}\},\\ &&\hspace{2em}\mathrm{layer}(G, \mathrm{der}(G)) \leq \mathrm{lmax}\} \end{eqnarray} \] The fud tree search function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesSearcherFudMaxRollByM :: 
  Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> 
  System -> Histogram -> Histogram ->
  Maybe [Fud]

as

parametersSystemsSamplesShufflesSearcherFudMaxRollByM lmax xmax omax bmax mmax pmax uu aa aarr
  ...
  | vars aa `subset` uvars uu = Just $ ls uu fudEmpty lmax
  | otherwise = Nothing
  where
    ls _ _ 0 = []
    ls uu ff h = gg : ls (uu `uunion` fsys gg) gg (h-1)
      where
        gg = ff `funion` llff [(pptt . ttpp . fftt) (depends (fexplode hh) w) | 
               kk <- topff (bmax `div` mmax) ff (zzffcstupopt xmax omax uu aa aarr ff), 
               hh <- concat (map (top 1) (zzll (zzcsddecoptmm mmax pmax uu aa aarr ff kk))), 
               w <- qqll (fder hh)]
    zzffcstupopt xmax omax uu aa aarr ff = fst $ unzip $ fromJust $ 
      parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple xmax omax uu aa aarr ff
    zzcsddecoptmm mmax pmax uu aa aarr ff kk = fromJust $
      parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementingMaxRollByM 
        mmax pmax uu aa aarr ff kk
    ...

An implementation with the partition variables replaced by cardinal variables has an additional argument of a list of variables, [Variable]. It is also defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesListVariablesSearcherFudMaxRollByM :: 
  Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> 
  System -> Histogram -> Histogram -> [Variable] ->
  Maybe ([Fud],(System,[Variable]))

For example,

let zzfudsmm aa aarr lmax xmax omax bmax mmax pmax = fromJust $ parametersSystemsSamplesShufflesSearcherFudMaxRollByM lmax xmax omax bmax mmax pmax (sys aa) aa aarr

let zzllfudsmm aa aarr lmax xmax omax bmax mmax pmax = fst $ fromJust $ parametersSystemsSamplesShufflesListVariablesSearcherFudMaxRollByM lmax xmax omax bmax mmax pmax (sys aa) aa aarr [VarInt i | i <-[10..]]


let aa = resize 100 $ regpivot 3 2

rpln $ map fmpi $ zzfudsmm aa (ind aa) 1 (3^2) 2 2 2 1
"{({({(1,1),(3,1)},1 % 1),({(1,2),(3,2)},1 % 1),({(1,3),(3,2)},1 % 1)},{3}),({({(2,1),(4,1)},1 % 1),({(2,2),(4,2)},1 % 1),({(2,3),(4,2)},1 % 1)},{4})}"


let aa = resize 100 $ regpivot 3 3

rpln $ zzllfudsmm aa (ind aa) 1 (3^3) 3 3 3 1
"{({({(1,1),(3,1),(331,1)},1 % 1),({(1,1),(3,2),(331,1)},1 % 1),({(1,1),(3,3),(331,1)},1 % 1),({(1,2),(3,1),(331,1)},1 % 1),({(1,2),(3,2),(331,2)},1 % 1),({(1,2),(3,3),(331,2)},1 % 1),({(1,3),(3,1),(331,1)},1 % 1),({(1,3),(3,2),(331,2)},1 % 1),({(1,3),(3,3),(331,2)},1 % 1)},{331}),({({(1,1),(380,1)},1 % 1),({(1,2),(380,2)},1 % 1),({(1,3),(380,2)},1 % 1)},{380}),({({(2,1),(381,1)},1 % 1),({(2,2),(381,2)},1 % 1),({(2,3),(381,2)},1 % 1)},{381}),({({(3,1),(382,1)},1 % 1),({(3,2),(382,2)},1 % 1),({(3,3),(382,2)},1 % 1)},{382})}"


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

rpln $ zzllfudsmm aa (ind aa) 1 (3^3) 3 3 3 1
"{({({(1,1),(24,1)},1 % 1),({(1,2),(24,2)},1 % 1),({(1,3),(24,2)},1 % 1)},{24}),({({(2,1),(25,1)},1 % 1),({(2,2),(25,2)},1 % 1),({(2,3),(25,2)},1 % 1)},{25})}"

rpln $ zzllfudsmm aa (ind aa) 2 (3^3) 3 3 3 1
"{({({(1,1),(24,1)},1 % 1),({(1,2),(24,2)},1 % 1),({(1,3),(24,2)},1 % 1)},{24}),({({(2,1),(25,1)},1 % 1),({(2,2),(25,2)},1 % 1),({(2,3),(25,2)},1 % 1)},{25})}"
"{({({(1,1),(24,1)},1 % 1),({(1,2),(24,2)},1 % 1),({(1,3),(24,2)},1 % 1)},{24}),({({(2,1),(25,1)},1 % 1),({(2,2),(25,2)},1 % 1),({(2,3),(25,2)},1 % 1)},{25}),({({(24,1),(30,1)},1 % 1),({(24,2),(30,2)},1 % 1)},{30}),({({(25,1),(31,1)},1 % 1),({(25,2),(31,2)},1 % 1)},{31})}"

rpln $ zzllfudsmm aa (ind aa) 1 (3^4) 3 3 3 1
"{({({(1,1),(4,1),(986,1)},1 % 1),({(1,1),(4,2),(986,1)},1 % 1),({(1,1),(4,3),(986,1)},1 % 1),({(1,2),(4,1),(986,2)},1 % 1),({(1,2),(4,2),(986,2)},1 % 1),({(1,2),(4,3),(986,2)},1 % 1),({(1,3),(4,1),(986,2)},1 % 1),({(1,3),(4,2),(986,2)},1 % 1),({(1,3),(4,3),(986,2)},1 % 1)},{986}),({({(1,1),(1575,1)},1 % 1),({(1,2),(1575,2)},1 % 1),({(1,3),(1575,2)},1 % 1)},{1575}),({({(2,1),(3,1),(987,1)},1 % 1),({(2,1),(3,2),(987,1)},1 % 1),({(2,1),(3,3),(987,1)},1 % 1),({(2,2),(3,1),(987,2)},1 % 1),({(2,2),(3,2),(987,2)},1 % 1),({(2,2),(3,3),(987,2)},1 % 1),({(2,3),(3,1),(987,2)},1 % 1),({(2,3),(3,2),(987,2)},1 % 1),({(2,3),(3,3),(987,2)},1 % 1)},{987}),({({(2,1),(4,1),(1574,1)},1 % 1),({(2,1),(4,2),(1574,1)},1 % 1),({(2,1),(4,3),(1574,1)},1 % 1),({(2,2),(4,1),(1574,2)},1 % 1),({(2,2),(4,2),(1574,3)},1 % 1),({(2,2),(4,3),(1574,3)},1 % 1),({(2,3),(4,1),(1574,2)},1 % 1),({(2,3),(4,2),(1574,3)},1 % 1),({(2,3),(4,3),(1574,3)},1 % 1)},{1574}),({({(3,1),(1576,1)},1 % 1),({(3,2),(1576,2)},1 % 1),({(3,3),(1576,2)},1 % 1)},{1576})}"

rpln $ zzllfudsmm aa (ind aa) 2 (3^4) 3 3 3 1
"{({({(1,1),(4,1),(986,1)},1 % 1),({(1,1),(4,2),(986,1)},1 % 1),({(1,1),(4,3),(986,1)},1 % 1),({(1,2),(4,1),(986,2)},1 % 1),({(1,2),(4,2),(986,2)},1 % 1),({(1,2),(4,3),(986,2)},1 % 1),({(1,3),(4,1),(986,2)},1 % 1),({(1,3),(4,2),(986,2)},1 % 1),({(1,3),(4,3),(986,2)},1 % 1)},{986}),({({(1,1),(1575,1)},1 % 1),({(1,2),(1575,2)},1 % 1),({(1,3),(1575,2)},1 % 1)},{1575}),({({(2,1),(3,1),(987,1)},1 % 1),({(2,1),(3,2),(987,1)},1 % 1),({(2,1),(3,3),(987,1)},1 % 1),({(2,2),(3,1),(987,2)},1 % 1),({(2,2),(3,2),(987,2)},1 % 1),({(2,2),(3,3),(987,2)},1 % 1),({(2,3),(3,1),(987,2)},1 % 1),({(2,3),(3,2),(987,2)},1 % 1),({(2,3),(3,3),(987,2)},1 % 1)},{987}),({({(2,1),(4,1),(1574,1)},1 % 1),({(2,1),(4,2),(1574,1)},1 % 1),({(2,1),(4,3),(1574,1)},1 % 1),({(2,2),(4,1),(1574,2)},1 % 1),({(2,2),(4,2),(1574,3)},1 % 1),({(2,2),(4,3),(1574,3)},1 % 1),({(2,3),(4,1),(1574,2)},1 % 1),({(2,3),(4,2),(1574,3)},1 % 1),({(2,3),(4,3),(1574,3)},1 % 1)},{1574}),({({(3,1),(1576,1)},1 % 1),({(3,2),(1576,2)},1 % 1),({(3,3),(1576,2)},1 % 1)},{1576})}"
"{({({(1,1),(4,1),(986,1)},1 % 1),({(1,1),(4,2),(986,1)},1 % 1),({(1,1),(4,3),(986,1)},1 % 1),({(1,2),(4,1),(986,2)},1 % 1),({(1,2),(4,2),(986,2)},1 % 1),({(1,2),(4,3),(986,2)},1 % 1),({(1,3),(4,1),(986,2)},1 % 1),({(1,3),(4,2),(986,2)},1 % 1),({(1,3),(4,3),(986,2)},1 % 1)},{986}),({({(1,1),(1575,1)},1 % 1),({(1,2),(1575,2)},1 % 1),({(1,3),(1575,2)},1 % 1)},{1575}),({({(2,1),(3,1),(987,1)},1 % 1),({(2,1),(3,2),(987,1)},1 % 1),({(2,1),(3,3),(987,1)},1 % 1),({(2,2),(3,1),(987,2)},1 % 1),({(2,2),(3,2),(987,2)},1 % 1),({(2,2),(3,3),(987,2)},1 % 1),({(2,3),(3,1),(987,2)},1 % 1),({(2,3),(3,2),(987,2)},1 % 1),({(2,3),(3,3),(987,2)},1 % 1)},{987}),({({(2,1),(4,1),(1574,1)},1 % 1),({(2,1),(4,2),(1574,1)},1 % 1),({(2,1),(4,3),(1574,1)},1 % 1),({(2,2),(4,1),(1574,2)},1 % 1),({(2,2),(4,2),(1574,3)},1 % 1),({(2,2),(4,3),(1574,3)},1 % 1),({(2,3),(4,1),(1574,2)},1 % 1),({(2,3),(4,2),(1574,3)},1 % 1),({(2,3),(4,3),(1574,3)},1 % 1)},{1574}),({({(3,1),(1576,1)},1 % 1),({(3,2),(1576,2)},1 % 1),({(3,3),(1576,2)},1 % 1)},{1576}),({({(4,1),(987,1),(1574,1),(4047,1)},1 % 1),({(4,1),(987,1),(1574,2),(4047,1)},1 % 1),({(4,1),(987,1),(1574,3),(4047,1)},1 % 1),({(4,1),(987,2),(1574,1),(4047,1)},1 % 1),({(4,1),(987,2),(1574,2),(4047,2)},1 % 1),({(4,1),(987,2),(1574,3),(4047,1)},1 % 1),({(4,2),(987,1),(1574,1),(4047,1)},1 % 1),({(4,2),(987,1),(1574,2),(4047,1)},1 % 1),({(4,2),(987,1),(1574,3),(4047,1)},1 % 1),({(4,2),(987,2),(1574,1),(4047,1)},1 % 1),({(4,2),(987,2),(1574,2),(4047,1)},1 % 1),({(4,2),(987,2),(1574,3),(4047,2)},1 % 1),({(4,3),(987,1),(1574,1),(4047,1)},1 % 1),({(4,3),(987,1),(1574,2),(4047,1)},1 % 1),({(4,3),(987,1),(1574,3),(4047,1)},1 % 1),({(4,3),(987,2),(1574,1),(4047,1)},1 % 1),({(4,3),(987,2),(1574,2),(4047,1)},1 % 1),({(4,3),(987,2),(1574,3),(4047,2)},1 % 1)},{4047}),({({(4,1),(1575,1),(4291,1)},1 % 1),({(4,1),(1575,2),(4291,2)},1 % 1),({(4,2),(1575,1),(4291,1)},1 % 1),({(4,2),(1575,2),(4291,3)},1 % 1),({(4,3),(1575,1),(4291,1)},1 % 1),({(4,3),(1575,2),(4291,3)},1 % 1)},{4291}),({({(987,1),(1576,1),(4290,1)},1 % 1),({(987,1),(1576,2),(4290,1)},1 % 1),({(987,2),(1576,1),(4290,2)},1 % 1),({(987,2),(1576,2),(4290,3)},1 % 1)},{4290}),({({(1574,1),(4292,1)},1 % 1),({(1574,2),(4292,1)},1 % 1),({(1574,3),(4292,2)},1 % 1)},{4292}),({({(1575,1),(1576,1),(4048,1)},1 % 1),({(1575,1),(1576,2),(4048,1)},1 % 1),({(1575,2),(1576,1),(4048,2)},1 % 1),({(1575,2),(1576,2),(4048,2)},1 % 1)},{4048})}"

Now each layer is larger than for the fud tree searcher. This is because there are pmax tuple partitions for each derived-dimension. That is, the layer cardinality increases by a factor of mmax - 1.

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

let aa = hhaa hh

rpln $ zzllfudsmm aa (ind aa) 1 (3^4) 4 4 4 1
"{({({(cloud,heavy),(rain,heavy),(952,1)},1 % 1),({(cloud,heavy),(rain,light),(952,1)},1 % 1),({(cloud,heavy),(rain,none),(952,1)},1 % 1),({(cloud,light),(rain,heavy),(952,2)},1 % 1),({(cloud,light),(rain,light),(952,2)},1 % 1),({(cloud,light),(rain,none),(952,2)},1 % 1),({(cloud,none),(rain,heavy),(952,1)},1 % 1),({(cloud,none),(rain,light),(952,1)},1 % 1),({(cloud,none),(rain,none),(952,2)},1 % 1)},{952}),({({(cloud,heavy),(1020,1)},1 % 1),({(cloud,light),(1020,2)},1 % 1),({(cloud,none),(1020,3)},1 % 1)},{1020}),({({(cloud,heavy),(1579,1)},1 % 1),({(cloud,light),(1579,2)},1 % 1),({(cloud,none),(1579,2)},1 % 1)},{1579}),({({(pressure,high),(wind,light),(953,1)},1 % 1),({(pressure,high),(wind,none),(953,1)},1 % 1),({(pressure,high),(wind,strong),(953,1)},1 % 1),({(pressure,low),(wind,light),(953,2)},1 % 1),({(pressure,low),(wind,none),(953,1)},1 % 1),({(pressure,low),(wind,strong),(953,2)},1 % 1),({(pressure,medium),(wind,light),(953,2)},1 % 1),({(pressure,medium),(wind,none),(953,1)},1 % 1),({(pressure,medium),(wind,strong),(953,1)},1 % 1)},{953}),({({(pressure,high),(wind,light),(1580,1)},1 % 1),({(pressure,high),(wind,none),(1580,1)},1 % 1),({(pressure,high),(wind,strong),(1580,1)},1 % 1),({(pressure,low),(wind,light),(1580,2)},1 % 1),({(pressure,low),(wind,none),(1580,1)},1 % 1),({(pressure,low),(wind,strong),(1580,2)},1 % 1),({(pressure,medium),(wind,light),(1580,1)},1 % 1),({(pressure,medium),(wind,none),(1580,1)},1 % 1),({(pressure,medium),(wind,strong),(1580,1)},1 % 1)},{1580}),({({(pressure,high),(1018,1)},1 % 1),({(pressure,low),(1018,2)},1 % 1),({(pressure,medium),(1018,2)},1 % 1)},{1018}),({({(rain,heavy),(1021,1)},1 % 1),({(rain,light),(1021,2)},1 % 1),({(rain,none),(1021,3)},1 % 1)},{1021}),({({(rain,heavy),(1581,1)},1 % 1),({(rain,light),(1581,2)},1 % 1),({(rain,none),(1581,2)},1 % 1)},{1581}),({({(wind,light),(1019,1)},1 % 1),({(wind,none),(1019,1)},1 % 1),({(wind,strong),(1019,2)},1 % 1)},{1019})}"


let ff1 = last $ zzllfudsmm aa (ind aa) 1 (3^4) 4 4 4 1

Set.size $ ffqq ff1
9

rp $ fvars ff1
"{cloud,pressure,rain,wind,952,953,1018,1019,1020,1021,1579,1580,1581}"

rp $ fder ff1
"{952,953,1018,1019,1020,1021,1579,1580,1581}"

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff1
"({(cloud,heavy),(rain,heavy),(952,1)},1 % 1)"
"({(cloud,heavy),(rain,light),(952,1)},1 % 1)"
"({(cloud,heavy),(rain,none),(952,1)},1 % 1)"
"({(cloud,light),(rain,heavy),(952,2)},1 % 1)"
"({(cloud,light),(rain,light),(952,2)},1 % 1)"
"({(cloud,light),(rain,none),(952,2)},1 % 1)"
"({(cloud,none),(rain,heavy),(952,1)},1 % 1)"
"({(cloud,none),(rain,light),(952,1)},1 % 1)"
"({(cloud,none),(rain,none),(952,2)},1 % 1)"
"({(cloud,heavy),(1020,1)},1 % 1)"
"({(cloud,light),(1020,2)},1 % 1)"
"({(cloud,none),(1020,3)},1 % 1)"
"({(cloud,heavy),(1579,1)},1 % 1)"
"({(cloud,light),(1579,2)},1 % 1)"
"({(cloud,none),(1579,2)},1 % 1)"
"({(pressure,high),(wind,light),(953,1)},1 % 1)"
"({(pressure,high),(wind,none),(953,1)},1 % 1)"
"({(pressure,high),(wind,strong),(953,1)},1 % 1)"
"({(pressure,low),(wind,light),(953,2)},1 % 1)"
"({(pressure,low),(wind,none),(953,1)},1 % 1)"
"({(pressure,low),(wind,strong),(953,2)},1 % 1)"
"({(pressure,medium),(wind,light),(953,2)},1 % 1)"
"({(pressure,medium),(wind,none),(953,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(953,1)},1 % 1)"
"({(pressure,high),(wind,light),(1580,1)},1 % 1)"
"({(pressure,high),(wind,none),(1580,1)},1 % 1)"
"({(pressure,high),(wind,strong),(1580,1)},1 % 1)"
"({(pressure,low),(wind,light),(1580,2)},1 % 1)"
"({(pressure,low),(wind,none),(1580,1)},1 % 1)"
"({(pressure,low),(wind,strong),(1580,2)},1 % 1)"
"({(pressure,medium),(wind,light),(1580,1)},1 % 1)"
"({(pressure,medium),(wind,none),(1580,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(1580,1)},1 % 1)"
"({(pressure,high),(1018,1)},1 % 1)"
"({(pressure,low),(1018,2)},1 % 1)"
"({(pressure,medium),(1018,2)},1 % 1)"
"({(rain,heavy),(1021,1)},1 % 1)"
"({(rain,light),(1021,2)},1 % 1)"
"({(rain,none),(1021,3)},1 % 1)"
"({(rain,heavy),(1581,1)},1 % 1)"
"({(rain,light),(1581,2)},1 % 1)"
"({(rain,none),(1581,2)},1 % 1)"
"({(wind,light),(1019,1)},1 % 1)"
"({(wind,none),(1019,1)},1 % 1)"
"({(wind,strong),(1019,2)},1 % 1)"

rpln $ aall $ aa `fapply` ff1
"({(952,1),(953,2),(1018,2),(1019,1),(1020,1),(1021,1),(1579,1),(1580,2),(1581,1)},2 % 1)"
"({(952,1),(953,2),(1018,2),(1019,1),(1020,3),(1021,2),(1579,2),(1580,1),(1581,2)},2 % 1)"
"({(952,1),(953,2),(1018,2),(1019,1),(1020,3),(1021,2),(1579,2),(1580,2),(1581,2)},1 % 1)"
"({(952,1),(953,2),(1018,2),(1019,2),(1020,1),(1021,1),(1579,1),(1580,2),(1581,1)},2 % 1)"
"({(952,2),(953,1),(1018,1),(1019,1),(1020,2),(1021,1),(1579,2),(1580,1),(1581,1)},1 % 1)"
"({(952,2),(953,1),(1018,1),(1019,1),(1020,3),(1021,3),(1579,2),(1580,1),(1581,2)},5 % 1)"
"({(952,2),(953,1),(1018,1),(1019,2),(1020,2),(1021,2),(1579,2),(1580,1),(1581,2)},1 % 1)"
"({(952,2),(953,1),(1018,2),(1019,1),(1020,2),(1021,2),(1579,2),(1580,1),(1581,2)},2 % 1)"
"({(952,2),(953,1),(1018,2),(1019,1),(1020,2),(1021,3),(1579,2),(1580,1),(1581,2)},1 % 1)"
"({(952,2),(953,1),(1018,2),(1019,1),(1020,3),(1021,3),(1579,2),(1580,1),(1581,2)},1 % 1)"
"({(952,2),(953,1),(1018,2),(1019,2),(1020,2),(1021,1),(1579,2),(1580,1),(1581,1)},1 % 1)"
"({(952,2),(953,2),(1018,2),(1019,1),(1020,2),(1021,2),(1579,2),(1580,1),(1581,2)},1 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff1)) `divide` (norm (vvc `fapply` ff1))
"({(952,1),(953,2),(1018,2),(1019,1),(1020,1),(1021,1),(1579,1),(1580,2),(1581,1)},8.1)"
"({(952,1),(953,2),(1018,2),(1019,1),(1020,3),(1021,2),(1579,2),(1580,1),(1581,2)},8.1)"
"({(952,1),(953,2),(1018,2),(1019,1),(1020,3),(1021,2),(1579,2),(1580,2),(1581,2)},4.05)"
"({(952,1),(953,2),(1018,2),(1019,2),(1020,1),(1021,1),(1579,1),(1580,2),(1581,1)},8.1)"
"({(952,2),(953,1),(1018,1),(1019,1),(1020,2),(1021,1),(1579,2),(1580,1),(1581,1)},2.025)"
"({(952,2),(953,1),(1018,1),(1019,1),(1020,3),(1021,3),(1579,2),(1580,1),(1581,2)},10.125)"
"({(952,2),(953,1),(1018,1),(1019,2),(1020,2),(1021,2),(1579,2),(1580,1),(1581,2)},4.05)"
"({(952,2),(953,1),(1018,2),(1019,1),(1020,2),(1021,2),(1579,2),(1580,1),(1581,2)},4.05)"
"({(952,2),(953,1),(1018,2),(1019,1),(1020,2),(1021,3),(1579,2),(1580,1),(1581,2)},2.025)"
"({(952,2),(953,1),(1018,2),(1019,1),(1020,3),(1021,3),(1579,2),(1580,1),(1581,2)},2.025)"
"({(952,2),(953,1),(1018,2),(1019,2),(1020,2),(1021,1),(1579,2),(1580,1),(1581,1)},4.05)"
"({(952,2),(953,2),(1018,2),(1019,1),(1020,2),(1021,2),(1579,2),(1580,1),(1581,2)},4.05)"


algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
13.138769921122694

algnden (aa `fapply` ff1) - algnden (ind aa `fapply` ff1)
6.003345261539998

ent (aa `fapply` ff1)
2.316113923221488

cent (fftt ff1) aa
0.23756763480830867

rent (aa `fapply` ff1) (vvc `fapply` ff1)
26.299236885297205

Now consider let lmax = 2,

let ff2 = last $ zzllfudsmm aa (ind aa) 2 (3^4) 4 4 4 1

Set.size $ ffqq ff2
15

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff2
...
"({(953,1),(1018,1),(1580,1),(3191,1)},1 % 1)"
"({(953,1),(1018,1),(1580,2),(3191,2)},1 % 1)"
"({(953,1),(1018,2),(1580,1),(3191,1)},1 % 1)"
"({(953,1),(1018,2),(1580,2),(3191,1)},1 % 1)"
"({(953,2),(1018,1),(1580,1),(3191,1)},1 % 1)"
"({(953,2),(1018,1),(1580,2),(3191,1)},1 % 1)"
"({(953,2),(1018,2),(1580,1),(3191,2)},1 % 1)"
"({(953,2),(1018,2),(1580,2),(3191,2)},1 % 1)"
"({(953,1),(1021,1),(1580,1),(2715,1)},1 % 1)"
"({(953,1),(1021,1),(1580,2),(2715,1)},1 % 1)"
"({(953,1),(1021,2),(1580,1),(2715,1)},1 % 1)"
"({(953,1),(1021,2),(1580,2),(2715,1)},1 % 1)"
"({(953,1),(1021,3),(1580,1),(2715,2)},1 % 1)"
"({(953,1),(1021,3),(1580,2),(2715,1)},1 % 1)"
"({(953,2),(1021,1),(1580,1),(2715,1)},1 % 1)"
"({(953,2),(1021,1),(1580,2),(2715,3)},1 % 1)"
"({(953,2),(1021,2),(1580,1),(2715,2)},1 % 1)"
"({(953,2),(1021,2),(1580,2),(2715,2)},1 % 1)"
"({(953,2),(1021,3),(1580,1),(2715,2)},1 % 1)"
"({(953,2),(1021,3),(1580,2),(2715,1)},1 % 1)"
"({(953,1),(2795,1)},1 % 1)"
"({(953,2),(2795,2)},1 % 1)"
"({(1018,1),(1580,1),(2793,1)},1 % 1)"
"({(1018,1),(1580,2),(2793,1)},1 % 1)"
"({(1018,2),(1580,1),(2793,1)},1 % 1)"
"({(1018,2),(1580,2),(2793,2)},1 % 1)"
"({(1021,1),(3193,1)},1 % 1)"
"({(1021,2),(3193,2)},1 % 1)"
"({(1021,3),(3193,3)},1 % 1)"

algn (aa `fapply` ff2) - algn (ind aa `fapply` ff2)
11.905173335903175

algnden (aa `fapply` ff2) - algnden (ind aa `fapply` ff2)
5.136562090538776

ent (aa `fapply` ff2)
2.180945560561596

cent (fftt ff2) aa
0.3727359974682

rent (aa `fapply` ff2) (vvc `fapply` ff2)
22.38861803951454

Adding an extra layer reduces the alignment of the whole layer. Two of the derived variables, 2795 and 3193, are reframes of their underlying variables.

Now consider predicting the rain,

let ff1 = last $ zzllfudsmm (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 1 (3^3) 3 3 3 1


Set.size $ ffqq ff1
4

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff1
"({(cloud,heavy),(353,1)},1 % 1)"
"({(cloud,light),(353,2)},1 % 1)"
"({(cloud,none),(353,2)},1 % 1)"
"({(pressure,high),(wind,light),(354,1)},1 % 1)"
"({(pressure,high),(wind,none),(354,1)},1 % 1)"
"({(pressure,high),(wind,strong),(354,1)},1 % 1)"
"({(pressure,low),(wind,light),(354,2)},1 % 1)"
"({(pressure,low),(wind,none),(354,1)},1 % 1)"
"({(pressure,low),(wind,strong),(354,2)},1 % 1)"
"({(pressure,medium),(wind,light),(354,1)},1 % 1)"
"({(pressure,medium),(wind,none),(354,1)},1 % 1)"
"({(pressure,medium),(wind,strong),(354,1)},1 % 1)"
"({(pressure,high),(66,1)},1 % 1)"
"({(pressure,low),(66,2)},1 % 1)"
"({(pressure,medium),(66,1)},1 % 1)"
"({(wind,light),(65,1)},1 % 1)"
"({(wind,none),(65,1)},1 % 1)"
"({(wind,strong),(65,2)},1 % 1)"

rpln $ aall $ aa `fapply` ff1
"({(65,1),(66,1),(353,2),(354,1)},12 % 1)"
"({(65,1),(66,2),(353,1),(354,2)},2 % 1)"
"({(65,1),(66,2),(353,2),(354,1)},1 % 1)"
"({(65,1),(66,2),(353,2),(354,2)},1 % 1)"
"({(65,2),(66,1),(353,2),(354,1)},2 % 1)"
"({(65,2),(66,2),(353,1),(354,2)},2 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff1)) `divide` (norm (vvc `fapply` ff1))
"({(65,1),(66,1),(353,2),(354,1)},2.025)"
"({(65,1),(66,2),(353,1),(354,2)},2.7)"
"({(65,1),(66,2),(353,2),(354,1)},0.675)"
"({(65,1),(66,2),(353,2),(354,2)},0.675)"
"({(65,2),(66,1),(353,2),(354,1)},0.675)"
"({(65,2),(66,2),(353,1),(354,2)},2.7)"

algn (aa `fapply` ff1) - algn (ind aa `fapply` ff1)
7.702225116564721

algnden (aa `fapply` ff1) - algnden (ind aa `fapply` ff1)
3.8511125582823604

ent (aa `fapply` ff1)
1.2968441295132072

cent (fftt ff1) (aa `red` [cloud,pressure,wind])
1.1875227104605945

rent (aa `fapply` ff1) (vvc `fapply` ff1)
9.134261560638606

tlalgn (fftt ff1) aa [rain]
13.336468666994408

tlent (fftt ff1) aa [rain]
12.038625670709138

size $ eff (aa `fapply` ff1) `mul` (vvc `fapply` ff1)
54 % 1

Now consider let lmax = 2,


let ff2 = last $ zzllfudsmm (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 2 (3^3) 3 3 3 1


Set.size $ ffqq ff2
8

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff2
...
"({(65,1),(66,1),(354,1),(648,1)},1 % 1)"
"({(65,1),(66,1),(354,2),(648,1)},1 % 1)"
"({(65,1),(66,2),(354,1),(648,1)},1 % 1)"
"({(65,1),(66,2),(354,2),(648,2)},1 % 1)"
"({(65,2),(66,1),(354,1),(648,1)},1 % 1)"
"({(65,2),(66,1),(354,2),(648,1)},1 % 1)"
"({(65,2),(66,2),(354,1),(648,1)},1 % 1)"
"({(65,2),(66,2),(354,2),(648,2)},1 % 1)"
"({(65,1),(66,1),(418,1)},1 % 1)"
"({(65,1),(66,2),(418,2)},1 % 1)"
"({(65,2),(66,1),(418,2)},1 % 1)"
"({(65,2),(66,2),(418,2)},1 % 1)"
"({(354,1),(420,1)},1 % 1)"
"({(354,2),(420,2)},1 % 1)"

algn (aa `fapply` ff2) - algn (ind aa `fapply` ff2)
9.196888285500176

algnden (aa `fapply` ff2) - algnden (ind aa `fapply` ff2)
4.240261724536667

ent (aa `fapply` ff2)
1.4446460691338838

cent (fftt ff2) (aa `red` [cloud,pressure,wind])
1.0397207708399179

rent (aa `fapply` ff2) (vvc `fapply` ff2)
11.455596913796626

tlalgn (fftt ff2) aa [rain]
18.84487676137921

tlent (fftt ff2) aa [rain]
10.567106745194575

size $ eff (aa `fapply` ff2) `mul` (vvc `fapply` ff2)
45 % 1

The addition of the extra layer increases the alignment, alignment density and label alignment and decreases the label entropy, but the effectiveness of the query has decreased.

Now consider let lmax = 3,


let ff3 = last $ zzllfudsmm (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 3 (3^3) 3 3 3 1


Set.size $ ffqq ff3
12

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff3
...
"({(66,1),(354,1),(648,1),(847,1)},1 % 1)"
"({(66,1),(354,1),(648,2),(847,1)},1 % 1)"
"({(66,1),(354,2),(648,1),(847,1)},1 % 1)"
"({(66,1),(354,2),(648,2),(847,1)},1 % 1)"
"({(66,2),(354,1),(648,1),(847,1)},1 % 1)"
"({(66,2),(354,1),(648,2),(847,1)},1 % 1)"
"({(66,2),(354,2),(648,1),(847,1)},1 % 1)"
"({(66,2),(354,2),(648,2),(847,2)},1 % 1)"
"({(66,1),(873,1)},1 % 1)"
"({(66,2),(873,2)},1 % 1)"
"({(353,1),(874,1)},1 % 1)"
"({(353,2),(874,2)},1 % 1)"
...
"({(354,1),(648,1),(872,1)},1 % 1)"
"({(354,1),(648,2),(872,1)},1 % 1)"
"({(354,2),(648,1),(872,1)},1 % 1)"
"({(354,2),(648,2),(872,2)},1 % 1)"

algn (aa `fapply` ff3) - algn (ind aa `fapply` ff3)
9.487032047960751

algnden (aa `fapply` ff3) - algnden (ind aa `fapply` ff3)
4.476560701629013

ent (aa `fapply` ff3)
1.5401231943781057

cent (fftt ff3) (aa `red` [cloud,pressure,wind])
0.9442436455956961

rent (aa `fapply` ff3) (vvc `fapply` ff3)
11.455596913796654

tlalgn (fftt ff3) aa [rain]
20.866258443235328

tlent (fftt ff3) aa [rain]
10.043858601430028

size $ eff (aa `fapply` ff3) `mul` (vvc `fapply` ff3)
45 % 1

Again, the addition of the extra layer has seen a small improvement in the model, this time without a decrease in model effectiveness.

Now consider let lmax = 4,


let ff4 = last $ zzllfudsmm (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 4 (3^3) 3 3 3 1


Set.size $ ffqq ff4
14

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff4
...
"({(66,1),(354,1),(420,1),(1072,1)},1 % 1)"
"({(66,1),(354,1),(420,2),(1072,1)},1 % 1)"
"({(66,1),(354,2),(420,1),(1072,1)},1 % 1)"
"({(66,1),(354,2),(420,2),(1072,1)},1 % 1)"
"({(66,2),(354,1),(420,1),(1072,1)},1 % 1)"
"({(66,2),(354,1),(420,2),(1072,1)},1 % 1)"
"({(66,2),(354,2),(420,1),(1072,1)},1 % 1)"
"({(66,2),(354,2),(420,2),(1072,2)},1 % 1)"
...
"({(354,1),(420,1),(1097,1)},1 % 1)"
"({(354,1),(420,2),(1097,1)},1 % 1)"
"({(354,2),(420,1),(1097,1)},1 % 1)"
"({(354,2),(420,2),(1097,2)},1 % 1)"

algn (aa `fapply` ff4) - algn (ind aa `fapply` ff4)
9.48321037721847

algnden (aa `fapply` ff4) - algnden (ind aa `fapply` ff4)
4.507274230189813

ent (aa `fapply` ff4)
1.5401231943781057

cent (fftt ff4) (aa `red` [cloud,pressure,wind])
0.9442436455956961

rent (aa `fapply` ff4) (vvc `fapply` ff4)
11.455596913796654

tlalgn (fftt ff4) aa [rain]
21.51714990619474

tlent (fftt ff4) aa [rain]
10.043858601430028

size $ eff (aa `fapply` ff4) `mul` (vvc `fapply` ff4)
45 % 1

Again, the addition of the extra layer has seen a small in the alignment density. The other measures are little changed.

Now consider let lmax = 5,


let ff5 = last $ zzllfudsmm (aa `red` [pressure,cloud,wind]) (ind (aa `red` [pressure,cloud,wind])) 5 (3^3) 3 3 3 1


Set.size $ ffqq ff5
18

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ ff5
...
"({(354,1),(873,1),(1097,1),(1297,1)},1 % 1)"
"({(354,1),(873,1),(1097,2),(1297,1)},1 % 1)"
"({(354,1),(873,2),(1097,1),(1297,1)},1 % 1)"
"({(354,1),(873,2),(1097,2),(1297,1)},1 % 1)"
"({(354,2),(873,1),(1097,1),(1297,1)},1 % 1)"
"({(354,2),(873,1),(1097,2),(1297,1)},1 % 1)"
"({(354,2),(873,2),(1097,1),(1297,1)},1 % 1)"
"({(354,2),(873,2),(1097,2),(1297,2)},1 % 1)"
"({(354,1),(1097,1),(1322,1)},1 % 1)"
"({(354,1),(1097,2),(1322,1)},1 % 1)"
"({(354,2),(1097,1),(1322,1)},1 % 1)"
"({(354,2),(1097,2),(1322,2)},1 % 1)"
"({(873,1),(1323,1)},1 % 1)"
"({(873,2),(1323,2)},1 % 1)"
"({(874,1),(1324,1)},1 % 1)"
"({(874,2),(1324,2)},1 % 1)"

algn (aa `fapply` ff5) - algn (ind aa `fapply` ff5)
9.387595565790072

algnden (aa `fapply` ff5) - algnden (ind aa `fapply` ff5)
4.48702697106453

ent (aa `fapply` ff5)
1.5401231943781057

cent (fftt ff5) (aa `red` [cloud,pressure,wind])
0.9442436455956961

rent (aa `fapply` ff5) (vvc `fapply` ff5)
11.455596913796654

tlalgn (fftt ff5) aa [rain]
21.941028462793824

tlent (fftt ff5) aa [rain]
10.043858601430028

size $ eff (aa `fapply` ff5) `mul` (vvc `fapply` ff5)
45 % 1

Finally, in the fifth layer the alignment density begins to decrease.

Previously in the fud tree searcher, above, it was necessary to fine tune the derived-dimension parameter, mmax, to maximise the alignment and alignment density. Now in the maximum-roll-by-derived-dimension fud tree searcher there is no longer any need to manage the tuple partitions.

The weather forecast example continues in Limited-derived derived variables set list maximiser.

Excluded-self limited-layer limited-underlying limited-breadth fud tree searcher

Define the excluded-self limited-layer limited-underlying limited-breadth fud tree searcher as (Text) \[ Z_{P,A,A_R,\mathrm{L,xs}} = \mathrm{searchTreer}(\mathcal{F}_{\infty,U_A,V_A} \cap \mathcal{F}_{\mathrm{u}} \cap \mathcal{F}_{\mathrm{b}} \cap \mathcal{F}_{\mathrm{h}},P_{P,A,A_R,\mathrm{L,xs}},\{\emptyset\}) \] where the neighbourhood function returns a singleton \[ \begin{eqnarray} &&P_{P,A,A_R,\mathrm{L,xs}}(F) = \{G :\\ &&\hspace{2em}G = F \cup \{P^{\mathrm{T}} : K \in \mathrm{topd}(\lfloor\mathrm{bmax}/\mathrm{mmax}\rfloor)(\mathrm{elements}(Z_{P,A,A_R,F,\mathrm{B}})),\\ &&\hspace{5em}H \in \mathrm{topd}(\mathrm{pmax})(\mathrm{elements}(Z_{P,A,A_R,F,\mathrm{n},-,K})),\\ &&\hspace{5em}w \in \mathrm{der}(H),~I = \mathrm{depends}(\mathrm{explode}(H),\{w\}),\\ &&\hspace{5em}P = I^{\mathrm{TP}},~P \neq (\cup P)^{\{\}}\},\\ &&\hspace{2em}\mathrm{layer}(G, \mathrm{der}(G)) \leq \mathrm{lmax}\} \end{eqnarray} \]

The fud tree search function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesSearcherFudExcludedSelf :: 
  Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> 
  System -> Histogram -> Histogram ->
  Maybe [Fud]

as

parametersSystemsSamplesShufflesSearcherFudExcludedSelf lmax xmax omax bmax mmax umax pmax uu aa aarr
  ...
  | ... = Just $ ls uu fudEmpty lmax
  | otherwise = Nothing
  where
    ls _ _ 0 = []
    ls uu ff h = gg : ls (uu `uunion` fsys gg) gg (h-1)
      where
        gg = ff `funion` llff [pptt pp | 
               kk <- topff (bmax `div` mmax) ff (zzffcstupopt xmax omax uu aa aarr ff), 
               hh <- top pmax (zzcsddecoptw mmax umax pmax uu aa aarr ff kk), w <- qqll (fder hh),
               let pp = ttpp (fftt (depends (fexplode hh) w)), pp /= self uu (ppvars pp)]
    zzffcstupopt xmax omax uu aa aarr ff = fst $ unzip $ fromJust $ 
      parametersSystemsSamplesShufflesFudsFunctionOptimiserTuple xmax omax uu aa aarr ff
    zzcsddecoptw mmax umax pmax uu aa aarr ff kk = fst $ unzip $ fromJust $
      parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementingLimitedValency 
        mmax umax pmax uu aa aarr ff kk
    ...

Note that this implementation is additionally constrained to be limited-valency.

For example,

let zzfuds aa aarr lmax xmax omax bmax mmax umax pmax = fromJust $ parametersSystemsSamplesShufflesSearcherFud lmax xmax omax bmax mmax umax pmax (sys aa) aa aarr

let zzfudsxs aa aarr lmax xmax omax bmax mmax umax pmax = fromJust $ parametersSystemsSamplesShufflesSearcherFudExcludedSelf lmax xmax omax bmax mmax umax pmax (sys aa) aa aarr


let aa = resize 100 $ regpivot 3 2

rpln $ map fmpi $ zzfuds aa (ind aa) 3 (3^2) 2 2 2 (3^2) 1
"{({({(1,1),(3,1)},1 % 1),({(1,2),(3,2)},1 % 1),({(1,3),(3,2)},1 % 1)},{3}),({({(2,1),(4,1)},1 % 1),({(2,2),(4,2)},1 % 1),({(2,3),(4,2)},1 % 1)},{4})}"
"{({({(1,1),(3,1)},1 % 1),({(1,2),(3,2)},1 % 1),({(1,3),(3,2)},1 % 1)},{3}),({({(2,1),(4,1)},1 % 1),({(2,2),(4,2)},1 % 1),({(2,3),(4,2)},1 % 1)},{4}),({({(3,1),(5,1)},1 % 1),({(3,2),(5,2)},1 % 1)},{5}),({({(4,1),(6,1)},1 % 1),({(4,2),(6,2)},1 % 1)},{6})}"
"{({({(1,1),(3,1)},1 % 1),({(1,2),(3,2)},1 % 1),({(1,3),(3,2)},1 % 1)},{3}),({({(2,1),(4,1)},1 % 1),({(2,2),(4,2)},1 % 1),({(2,3),(4,2)},1 % 1)},{4}),({({(3,1),(5,1)},1 % 1),({(3,2),(5,2)},1 % 1)},{5}),({({(4,1),(6,1)},1 % 1),({(4,2),(6,2)},1 % 1)},{6}),({({(5,1),(7,1)},1 % 1),({(5,2),(7,2)},1 % 1)},{7})}"

rpln $ map fmpi $ zzfudsxs aa (ind aa) 3 (3^2) 2 2 2 (3^2) 1
"{({({(1,1),(3,1)},1 % 1),({(1,2),(3,2)},1 % 1),({(1,3),(3,2)},1 % 1)},{3}),({({(2,1),(4,1)},1 % 1),({(2,2),(4,2)},1 % 1),({(2,3),(4,2)},1 % 1)},{4})}"
"{({({(1,1),(3,1)},1 % 1),({(1,2),(3,2)},1 % 1),({(1,3),(3,2)},1 % 1)},{3}),({({(2,1),(4,1)},1 % 1),({(2,2),(4,2)},1 % 1),({(2,3),(4,2)},1 % 1)},{4})}"
"{({({(1,1),(3,1)},1 % 1),({(1,2),(3,2)},1 % 1),({(1,3),(3,2)},1 % 1)},{3}),({({(2,1),(4,1)},1 % 1),({(2,2),(4,2)},1 % 1),({(2,3),(4,2)},1 % 1)},{4})}"

Highest-layer layerer

The functionality of (i) the highest-layer limited-layer limited-underlying limited-breadth fud tree searcher, $Z_{P,A,A_R,\mathrm{L,d}}$, (Haskell) and (ii) the highest-layer limited-derived derived variables set list maximiser, $Z_{P,A,A_R,F,\mathrm{D,d}}$, (Haskell) is implemented in the highest-layer layerer $I_{P,U,\mathrm{L,d}} \in \mathrm{computers}$, which is defined such that (i) the domain is $\mathrm{domain}(I_{P,U,\mathrm{L,d}}) = \mathrm{P}(\mathcal{V}_U) \times \mathcal{A}_U \times \mathcal{A}_U \times \mathbf{N}$, (ii) the range is $\mathrm{range}(I_{P,U,\mathrm{L,d}}) = \mathcal{U} \times \mathcal{F} \times (\mathrm{P}(\mathcal{V}) \to \mathbf{Q})$, and (iii) the application is (Text) \[ \begin{eqnarray} I_{P,U,\mathrm{L,d}}^{ * }((V,A,A_R,f)) = \mathrm{layer}(V,U,\emptyset,\emptyset,A,A_R,f,1) \end{eqnarray} \] where \[ \begin{eqnarray} &&\mathrm{layer} \in \mathrm{P}(\mathcal{V}) \times \mathcal{U} \times \mathcal{F} \times ((\mathrm{P}(\mathcal{V}) \times \mathcal{A} \times \mathcal{A}) \to \mathbf{Q}) \times \mathcal{A} \times \mathcal{A} \times \mathbf{N} \times \mathbf{N} \to \\ &&\hspace{20em}(\mathcal{U} \times \mathcal{F} \times (\mathrm{P}(\mathcal{V}) \to \mathbf{Q})) \end{eqnarray} \] is defined \[ \begin{eqnarray} &&\mathrm{layer}(V,U,F,M,X,X_R,f,l) = \\ &&\hspace{1em}\mathrm{if}((l \leq \mathrm{lmax}) \wedge (H \neq \emptyset) \wedge (M \neq \emptyset \implies \mathrm{maxr}(M’)>\mathrm{maxr}(M)),\\ &&\hspace{4em}\mathrm{layer}(V,U’,F \cup H,M’,X’,X’_R,f,l+1),\\ &&\hspace{4em}(U,F,M)) :\\ &&\hspace{2em}L = \{(b,(T,(w, \mathrm{ran}(I)))) : \\ &&\hspace{4em}((\cdot,I),b) \in \mathrm{order}(D_{\mathrm{L}},\{(v,I) : \\ &&\hspace{6em}Q \in I_{P,U,\mathrm{B}}^{ * }((V,F,X,X_R)),\\ &&\hspace{6em}N \in I_{P,U,\mathrm{R}}^{ * }(I_{P,U,\mathrm{K}}^{ * }(Q)),\\ &&\hspace{6em}(v,I) \in N\}),\\ &&\hspace{4em}w=(f,l,b),~T = (\{S \cup \{(w,k)\} : (S,k) \in I\},\{w\})\},\\ &&\hspace{2em}L’ = \{(i,(T,(w,W))) : (i,(T,(w,W))) \in L, \\ &&\hspace{4em}\forall (i’,(T’,(w’,W’))) \in L~(i>i’ \implies T^{\mathrm{P}} \neq T^{‘\mathrm{P}})\},\\ &&\hspace{2em}H = \mathrm{dom}(\mathrm{set}(L’)),~U’ = U \cup \mathrm{ran}(\mathrm{set}(L’)),\\ &&\hspace{2em}X’ = I_{\mathrm{ * X}}^{ * }((H,X)),~X’_R = I_{\mathrm{ * X}}^{ * }((H,X_R)),\\ &&\hspace{2em}M’ = I_{P,U’,\mathrm{D,d}}^{ * }((V,F \cup H,X’,X’_R)) \end{eqnarray} \] where $I_{\mathrm{ * X}} = \mathrm{applier} \in \mathrm{computers}$.

The layer list, $L$, potentially contains duplicate transform partitions, $|\{T^{\mathrm{P}} : (\cdot,(T,\cdot)) \in L\}| \leq |L|$. These duplicates are stripped from the list $L’$ by crossing each new variable with all previous and checking that the transforms differ. Note that these implementations improve the performance of the check by testing the valency and underlying variables before testing the partition, $\forall (i’,(T’,(w’,W’))) \in L~(i>i’ \implies |W| \neq |W’| \wedge \mathrm{und}(T) \neq \mathrm{und}(T’) \wedge T^{\mathrm{P}} \neq T^{‘\mathrm{P}})$.

The layerer is defined in module AlignmentPracticable,

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

as

parametersSystemsLayererHighest wmax lmax xmax omax bmax mmax umax pmax uu vv aa aarr f
  ...
  | otherwise = Just $ layer vv uu fudEmpty Map.empty aa aarr f 1
  where
    layer vv uu ff mm xx xxrr f l = 
      if l <= lmax && hh /= fudEmpty && (mm == Map.empty || maxr mm' > maxr mm) then 
        layer vv uu' gg mm' xx' xxrr' f (l+1) else (uu,ff,mm) 
      where
        ll = [(tt,(w,ww)) | (ii,b) <- zip [ii | ((kk,bb,bbrr),y1) <- qqll (buildfftup uu vv ff xx xxrr), 
               nn <- qqll (roller (parter uu kk bb bbrr y1)), ii <- nn] [1..], 
               let w = VarPair (VarPair (VarInt f, VarInt l), VarInt b), 
               let ww = Set.map (\(_,u) -> (nnww u)) ii, 
               let tt = trans (unit [ss `sunion` ssgl w (nnww u) | (ss,u) <- qqll ii]) (sgl w)]
        ll' = [(tt,(w,ww)) | (tt,(w,ww)) <- ll, 
                and [Set.size ww /= Set.size ww' || und tt /= und tt' || ttpp tt /= ttpp tt' | (tt',(w',ww')) <- ll, w > w']]
        hh = qqff $ llqq $ fst $ unzip ll'
        uu' = uu `uunion` (lluu $ snd $ unzip ll')
        xx' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xx
        xxrr' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xxrr
        gg = ff `funion` hh
        mm' = buildffdervar uu' vv gg xx' xxrr'
    buildfftup uu vv ff xx xxrr = fromJust $ parametersSystemsBuilderTuple xmax omax bmax mmax uu vv ff xx xxrr
    parter uu kk bb bbrr y1 = fromJust $ parametersSystemsPartitioner mmax umax pmax uu kk bb bbrr y1
    roller qq = fromJust $ parametersRoller pmax qq
    buildffdervar uu vv ff xx xxrr = llmm $ map (\((kk,_,_),a) -> (kk,a)) $ mmll $ fromJust $
                                       parametersSystemsBuilderDerivedVarsHighest wmax omax uu vv ff xx xxrr
    ...

Maximum-roll highest-layer layerer

A variation of the highest-layer layerer, $I_{P,U,\mathrm{L,d}}$, is to implement the limited-valency maximum-roll contracted decrementing linear non-overlapping fuds tree maximiser, $Z_{P,A,A_R,F,\mathrm{n,w},-,K,\mathrm{mr}}$, (Haskell) by means of the maximum-roll tuple-partition value roller, $I_{P,U,\mathrm{R,mr}}$ (Haskell). The highest-layer maximum-roll layerer $I_{P,U,\mathrm{L,mr,d}} \in \mathrm{computers}$ is defined such that the application is (Text) \[ \begin{eqnarray} I_{P,U,\mathrm{L,mr,d}}^{ * }((V,A,A_R,f)) = \mathrm{layer}(V,U,\emptyset,\emptyset,A,A_R,f,1) \end{eqnarray} \] and \[ \begin{eqnarray} &&\mathrm{layer}(V,U,F,M,X,X_R,f,l) = \\ &&\hspace{1em}\mathrm{if}((l \leq \mathrm{lmax}) \wedge (H \neq \emptyset) \wedge (M \neq \emptyset \implies \mathrm{maxr}(M’)>\mathrm{maxr}(M)),\\ &&\hspace{4em}\mathrm{layer}(V,U’,F \cup H,M’,X’,X’_R,f,l+1),\\ &&\hspace{4em}(U,F,M)) :\\ &&\hspace{2em}L = \{(b,(T,(w, \mathrm{ran}(I)))) : \\ &&\hspace{4em}((\cdot,I),b) \in \mathrm{order}(D_{\mathrm{L}},\{(v,I) : \\ &&\hspace{6em}Q \in I_{P,U,\mathrm{B}}^{ * }((V,F,X,X_R)),\\ &&\hspace{6em}P \in I_{P,U,\mathrm{K}}^{ * }(Q),~N \in I_{P,U,\mathrm{R,mr}}^{ * }(P),\\ &&\hspace{6em}(v,I) \in N\}),\\ &&\hspace{4em}w=(f,l,b),~T = (\{S \cup \{(w,k)\} : (S,k) \in I\},\{w\})\},\\ &&\hspace{2em}L’ = \{(i,(T,(w,W))) : (i,(T,(w,W))) \in L, \\ &&\hspace{4em}\forall (i’,(T’,(w’,W’))) \in L~(i>i’ \implies T^{\mathrm{P}} \neq T^{‘\mathrm{P}})\},\\ &&\hspace{2em}H = \mathrm{dom}(\mathrm{set}(L’)),~U’ = U \cup \mathrm{ran}(\mathrm{set}(L’)),\\ &&\hspace{2em}X’ = I_{\mathrm{ * X}}^{ * }((H,X)),~X’_R = I_{\mathrm{ * X}}^{ * }((H,X_R)),\\ &&\hspace{2em}M’ = I_{P,U’,\mathrm{D,d}}^{ * }((V,F \cup H,X’,X’_R)) \end{eqnarray} \]

The layerer is defined in module AlignmentPracticable,

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

as

parametersSystemsLayererMaximumRollHighest wmax lmax xmax omax bmax mmax umax pmax uu vv aa aarr f
  ...
  | otherwise = Just $ layer vv uu fudEmpty Map.empty aa aarr f 1
  where
    layer vv uu ff mm xx xxrr f l = 
      if l <= lmax && hh /= fudEmpty && (mm == Map.empty || maxr mm' > maxr mm) then 
        layer vv uu' gg mm' xx' xxrr' f (l+1) else (uu,ff,mm) 
      where
        ll = [(tt,(w,ww)) | (ii,b) <- zip [ii | ((kk,bb,bbrr),y1) <- qqll (buildfftup uu vv ff xx xxrr), 
               pp <- qqll (parter uu kk bb bbrr y1), nn <- qqll (roller (sgl pp)), ii <- nn] [1..], 
               let w = VarPair (VarPair (VarInt f, VarInt l), VarInt b), 
               let ww = Set.map (\(_,u) -> (nnww u)) ii, 
               let tt = trans (unit [ss `sunion` ssgl w (nnww u) | (ss,u) <- qqll ii]) (sgl w)]
        ll' = [(tt,(w,ww)) | (tt,(w,ww)) <- ll, 
                and [Set.size ww /= Set.size ww' || und tt /= und tt' || ttpp tt /= ttpp tt' | (tt',(w',ww')) <- ll, w > w']]
        hh = qqff $ llqq $ fst $ unzip ll'
        uu' = uu `uunion` (lluu $ snd $ unzip ll')
        xx' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xx
        xxrr' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xxrr
        gg = ff `funion` hh
        mm' = buildffdervar uu' vv gg xx' xxrr'
    buildfftup uu vv ff xx xxrr = fromJust $ parametersSystemsBuilderTuple xmax omax bmax mmax uu vv ff xx xxrr
    parter uu kk bb bbrr y1 = fromJust $ parametersSystemsPartitioner mmax umax pmax uu kk bb bbrr y1
    roller qq = fromJust $ parametersRoller 1 qq
    buildffdervar uu vv ff xx xxrr = llmm $ map (\((kk,_,_),a) -> (kk,a)) $ mmll $ fromJust $
                                       parametersSystemsBuilderDerivedVarsHighest wmax omax uu vv ff xx xxrr
    ...

Excluded-self maximum-roll highest-layer layerer

A further variation of the highest-layer maximum-roll layerer $I_{P,U,\mathrm{L,mr,d}}$, is to add the functionality of the excluded-self contracted decrementing linear non-overlapping fuds tree maximiser, $Z_{P,A,A_R,\mathrm{L,xs}}$, (Haskell) by excluding self partitions. The highest-layer excluded-self maximum-roll layerer $I_{P,U,\mathrm{L,mr,xs,d}} \in \mathrm{computers}$ is defined such that the application is (Text) \[ \begin{eqnarray} I_{P,U,\mathrm{L,mr,xs,d}}^{ * }((V,A,A_R,f)) = \mathrm{layer}(V,U,\emptyset,\emptyset,A,A_R,f,1) \end{eqnarray} \] and \[ \begin{eqnarray} &&\mathrm{layer}(V,U,F,M,X,X_R,f,l) = \\ &&\hspace{1em}\mathrm{if}((l \leq \mathrm{lmax}) \wedge (H \neq \emptyset) \wedge (M \neq \emptyset \implies \mathrm{maxr}(M’)>\mathrm{maxr}(M)),\\ &&\hspace{4em}\mathrm{layer}(V,U’,F \cup H,M’,X’,X’_R,f,l+1),\\ &&\hspace{4em}(U,F,M)) :\\ &&\hspace{2em}L = \{(b,(T,(w, \mathrm{ran}(I)))) : \\ &&\hspace{4em}((\cdot,I),b) \in \mathrm{order}(D_{\mathrm{L}},\{(v,I) : \\ &&\hspace{6em}Q \in I_{P,U,\mathrm{B}}^{ * }((V,F,X,X_R)),\\ &&\hspace{6em}P \in I_{P,U,\mathrm{K}}^{ * }(Q),~N \in I_{P,U,\mathrm{R,mr}}^{ * }(P),\\ &&\hspace{6em}(v,I) \in N,~|\mathrm{ran}(I)|<|I|\}),\\ &&\hspace{4em}w=(f,l,b),~T = (\{S \cup \{(w,k)\} : (S,k) \in I\},\{w\})\},\\ &&\hspace{2em}L’ = \{(i,(T,(w,W))) : (i,(T,(w,W))) \in L, \\ &&\hspace{4em}\forall (i’,(T’,(w’,W’))) \in L~(i>i’ \implies T^{\mathrm{P}} \neq T^{‘\mathrm{P}})\},\\ &&\hspace{2em}H = \mathrm{dom}(\mathrm{set}(L’)),~U’ = U \cup \mathrm{ran}(\mathrm{set}(L’)),\\ &&\hspace{2em}X’ = I_{\mathrm{ * X}}^{ * }((H,X)),~X’_R = I_{\mathrm{ * X}}^{ * }((H,X_R)),\\ &&\hspace{2em}M’ = I_{P,U’,\mathrm{D,d}}^{ * }((V,F \cup H,X’,X’_R)) \end{eqnarray} \]

The layerer is defined in module AlignmentPracticable,

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

as

parametersSystemsLayererMaximumRollExcludedSelfHighest wmax lmax xmax omax bmax mmax umax pmax uu vv aa aarr f
  ...
  | otherwise = Just $ layer vv uu fudEmpty Map.empty aa aarr f 1
  where
    layer vv uu ff mm xx xxrr f l = 
      if l <= lmax && hh /= fudEmpty && (mm == Map.empty || maxr mm' > maxr mm) then 
        layer vv uu' gg mm' xx' xxrr' f (l+1) else (uu,ff,mm) 
      where
        ll = [(tt,(w,ww)) | (ii,b) <- zip [ii | ((kk,bb,bbrr),y1) <- qqll (buildfftup uu vv ff xx xxrr), 
               pp <- qqll (parter uu kk bb bbrr y1), nn <- qqll (roller (sgl pp)), ii <- nn, rancd ii < domcd ii] [1..], 
               let w = VarPair (VarPair (VarInt f, VarInt l), VarInt b), 
               let ww = Set.map (\(_,u) -> (nnww u)) ii, 
               let tt = trans (unit [ss `sunion` ssgl w (nnww u) | (ss,u) <- qqll ii]) (sgl w)]
        ll' = [(tt,(w,ww)) | (tt,(w,ww)) <- ll, 
                and [Set.size ww /= Set.size ww' || und tt /= und tt' || ttpp tt /= ttpp tt' | (tt',(w',ww')) <- ll, w > w']]
        hh = qqff $ llqq $ fst $ unzip ll'
        uu' = uu `uunion` (lluu $ snd $ unzip ll')
        xx' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xx
        xxrr' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xxrr
        gg = ff `funion` hh
        mm' = buildffdervar uu' vv gg xx' xxrr'
    buildfftup uu vv ff xx xxrr = fromJust $ 
      parametersSystemsBuilderTupleNoSumlayerMultiEffective xmax omax bmax mmax uu vv ff xx xxrr
    parter uu kk bb bbrr y1 = fromJust $ parametersSystemsPartitioner mmax umax pmax uu kk bb bbrr y1
    roller qq = fromJust $ parametersRoller 1 qq
    buildffdervar uu vv ff xx xxrr = llmm $ map (\((kk,_,_),a) -> (kk,a)) $ mmll $ fromJust $
      parametersSystemsBuilderDerivedVarsHighestNoSumlayer wmax omax uu vv ff xx xxrr
    ...

Excluded-self maximum-roll-by-derived-dimension highest-layer layerer

The highest-layer excluded-self maximum-roll-by-derived-dimension layerer $I_{P,U,\mathrm{L,mm,xs,d}} \in \mathrm{computers}$ is defined such that the application is (Text) \[ \begin{eqnarray} I_{P,U,\mathrm{L,mm,xs,d}}^{ * }((V,A,A_R,f)) = \mathrm{layer}(V,U,\emptyset,\emptyset,A,A_R,f,1) \end{eqnarray} \] and \[ \begin{eqnarray} &&\mathrm{layer}(V,U,F,M,X,X_R,f,l) = \\ &&\hspace{1em}\mathrm{if}((l \leq \mathrm{lmax}) \wedge (H \neq \emptyset) \wedge (M \neq \emptyset \implies \mathrm{maxr}(M’)>\mathrm{maxr}(M)),\\ &&\hspace{4em}\mathrm{layer}(V,U’,F \cup H,M’,X’,X’_R,f,l+1),\\ &&\hspace{4em}(U,F,M)) :\\ &&\hspace{2em}L = \{(b,(T,(w, \mathrm{ran}(I)))) : \\ &&\hspace{4em}((\cdot,I),b) \in \mathrm{order}(D_{\mathrm{L}},\{(v,I) : \\ &&\hspace{6em}Q \in I_{P,U,\mathrm{B}}^{ * }((V,F,X,X_R)),\\ &&\hspace{6em}P \in I_{P,U,\mathrm{K},\mathrm{mm}}^{ * }(Q),~N \in I_{P,U,\mathrm{R,mr}}^{ * }(P),\\ &&\hspace{6em}(v,I) \in N,~|\mathrm{ran}(I)|<|I|\}),\\ &&\hspace{4em}w=(f,l,b),~T = (\{S \cup \{(w,k)\} : (S,k) \in I\},\{w\})\},\\ &&\hspace{2em}L’ = \{(i,(T,(w,W))) : (i,(T,(w,W))) \in L, \\ &&\hspace{4em}\forall (i’,(T’,(w’,W’))) \in L~(i>i’ \implies T^{\mathrm{P}} \neq T^{‘\mathrm{P}})\},\\ &&\hspace{2em}H = \mathrm{dom}(\mathrm{set}(L’)),~U’ = U \cup \mathrm{ran}(\mathrm{set}(L’)),\\ &&\hspace{2em}X’ = I_{\mathrm{ * X}}^{ * }((H,X)),~X’_R = I_{\mathrm{ * X}}^{ * }((H,X_R)),\\ &&\hspace{2em}M’ = I_{P,U’,\mathrm{D,d}}^{ * }((V,F \cup H,X’,X’_R)) \end{eqnarray} \]

The layerer is defined in module AlignmentPracticable,

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

as

parametersSystemsLayererMaxRollByMExcludedSelfHighest wmax lmax xmax omax bmax mmax umax pmax uu vv aa aarr f
  ...
  | otherwise = Just $ layer vv uu fudEmpty Map.empty aa aarr f 1
  where
    layer vv uu ff mm xx xxrr f l = 
      if l <= lmax && hh /= fudEmpty && (mm == Map.empty || maxr mm' > maxr mm) then 
        layer vv uu' gg mm' xx' xxrr' f (l+1) else (uu,ff,mm) 
      where
        ll = [(tt,(w,ww)) | (ii,b) <- zip [ii | ((kk,bb,bbrr),y1) <- qqll (buildfftup uu vv ff xx xxrr), 
               pp <- qqll (parter uu kk bb bbrr y1), nn <- qqll (roller (sgl pp)), ii <- nn, rancd ii < domcd ii] [1..], 
               let w = VarPair (VarPair (VarInt f, VarInt l), VarInt b), 
               let ww = Set.map (\(_,u) -> (nnww u)) ii, 
               let tt = trans (unit [ss `sunion` ssgl w (nnww u) | (ss,u) <- qqll ii]) (sgl w)]
        ll' = [(tt,(w,ww)) | (tt,(w,ww)) <- ll, 
                and [Set.size ww /= Set.size ww' || und tt /= und tt' || ttpp tt /= ttpp tt' | (tt',(w',ww')) <- ll, w > w']]
        hh = qqff $ llqq $ fst $ unzip ll'
        uu' = uu `uunion` (lluu $ snd $ unzip ll')
        xx' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xx
        xxrr' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xxrr
        gg = ff `funion` hh
        mm' = buildffdervar uu' vv gg xx' xxrr'
    buildfftup uu vv ff xx xxrr = fromJust $ 
      parametersSystemsBuilderTupleNoSumlayerMultiEffective xmax omax bmax mmax uu vv ff xx xxrr
    parter uu kk bb bbrr y1 = fromJust $ parametersSystemsPartitionerMaxRollByM mmax umax pmax uu kk bb bbrr y1
    roller qq = fromJust $ parametersRoller 1 qq
    buildffdervar uu vv ff xx xxrr = llmm $ map (\((kk,_,_),a) -> (kk,a)) $ mmll $ fromJust $
      parametersSystemsBuilderDerivedVarsHighestNoSumlayer wmax omax uu vv ff xx xxrr
    ...

For example,

let layerermmxs aa aarr lmax xmax omax bmax mmax umax pmax = (\(_,ff,_) -> ff) $ fromJust $ parametersSystemsLayererMaxRollByMExcludedSelfHighest xmax lmax xmax omax bmax mmax umax pmax (sys aa) (vars aa) aa aarr 1


let aa = resize 100 $ regpivot 3 2

rp $ layerermmxs aa (ind aa) 1 (3^2) 2 2 2 (3^2) 1
"{({({(1,1),(<<1,1>,1>,0)},1 % 1),({(1,2),(<<1,1>,1>,1)},1 % 1),({(1,3),(<<1,1>,1>,1)},1 % 1)},{<<1,1>,1>}),({({(2,1),(<<1,1>,2>,0)},1 % 1),({(2,2),(<<1,1>,2>,1)},1 % 1),({(2,3),(<<1,1>,2>,1)},1 % 1)},{<<1,1>,2>})}"

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ layerermmxs aa (ind aa) 1 (3^2) 2 2 2 (3^2) 1
"({(1,1),(<<1,1>,1>,0)},1 % 1)"
"({(1,2),(<<1,1>,1>,1)},1 % 1)"
"({(1,3),(<<1,1>,1>,1)},1 % 1)"
"({(2,1),(<<1,1>,2>,0)},1 % 1)"
"({(2,2),(<<1,1>,2>,1)},1 % 1)"
"({(2,3),(<<1,1>,2>,1)},1 % 1)"

let aa = resize 100 $ regpivot 3 3

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ layerermmxs aa (ind aa) 1 (3^3) 3 3 3 (3^3) 1
"({(1,1),(3,1),(<<1,1>,4>,0)},1 % 1)"
"({(1,1),(3,2),(<<1,1>,4>,1)},1 % 1)"
"({(1,1),(3,3),(<<1,1>,4>,1)},1 % 1)"
"({(1,2),(3,1),(<<1,1>,4>,1)},1 % 1)"
"({(1,2),(3,2),(<<1,1>,4>,1)},1 % 1)"
"({(1,2),(3,3),(<<1,1>,4>,1)},1 % 1)"
"({(1,3),(3,1),(<<1,1>,4>,1)},1 % 1)"
"({(1,3),(3,2),(<<1,1>,4>,1)},1 % 1)"
"({(1,3),(3,3),(<<1,1>,4>,1)},1 % 1)"
"({(1,1),(<<1,1>,1>,0)},1 % 1)"
"({(1,2),(<<1,1>,1>,1)},1 % 1)"
"({(1,3),(<<1,1>,1>,1)},1 % 1)"
"({(2,1),(<<1,1>,2>,0)},1 % 1)"
"({(2,2),(<<1,1>,2>,1)},1 % 1)"
"({(2,3),(<<1,1>,2>,1)},1 % 1)"
"({(3,1),(<<1,1>,3>,0)},1 % 1)"
"({(3,2),(<<1,1>,3>,1)},1 % 1)"
"({(3,3),(<<1,1>,3>,1)},1 % 1)"

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

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ layerermmxs aa (ind aa) 2 (3^3) 3 3 3 (3^3) 1
"({(1,1),(<<1,1>,1>,0)},1 % 1)"
"({(1,2),(<<1,1>,1>,1)},1 % 1)"
"({(1,3),(<<1,1>,1>,1)},1 % 1)"
"({(2,1),(<<1,1>,2>,0)},1 % 1)"
"({(2,2),(<<1,1>,2>,1)},1 % 1)"
"({(2,3),(<<1,1>,2>,1)},1 % 1)"

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) $ layerermmxs aa (ind aa) 2 (3^4) 3 3 3 (3^4) 1
"({(1,1),(4,1),(<<1,1>,1>,0)},1 % 1)"
"({(1,1),(4,2),(<<1,1>,1>,0)},1 % 1)"
"({(1,1),(4,3),(<<1,1>,1>,0)},1 % 1)"
"({(1,2),(4,1),(<<1,1>,1>,3)},1 % 1)"
"({(1,2),(4,2),(<<1,1>,1>,4)},1 % 1)"
"({(1,2),(4,3),(<<1,1>,1>,4)},1 % 1)"
"({(1,3),(4,1),(<<1,1>,1>,3)},1 % 1)"
"({(1,3),(4,2),(<<1,1>,1>,4)},1 % 1)"
"({(1,3),(4,3),(<<1,1>,1>,4)},1 % 1)"
"({(1,1),(4,1),(<<1,1>,4>,0)},1 % 1)"
"({(1,1),(4,2),(<<1,1>,4>,0)},1 % 1)"
"({(1,1),(4,3),(<<1,1>,4>,0)},1 % 1)"
"({(1,2),(4,1),(<<1,1>,4>,3)},1 % 1)"
"({(1,2),(4,2),(<<1,1>,4>,3)},1 % 1)"
"({(1,2),(4,3),(<<1,1>,4>,3)},1 % 1)"
"({(1,3),(4,1),(<<1,1>,4>,3)},1 % 1)"
"({(1,3),(4,2),(<<1,1>,4>,3)},1 % 1)"
"({(1,3),(4,3),(<<1,1>,4>,3)},1 % 1)"
"({(2,1),(3,1),(<<1,1>,5>,0)},1 % 1)"
"({(2,1),(3,2),(<<1,1>,5>,0)},1 % 1)"
"({(2,1),(3,3),(<<1,1>,5>,0)},1 % 1)"
"({(2,2),(3,1),(<<1,1>,5>,3)},1 % 1)"
"({(2,2),(3,2),(<<1,1>,5>,3)},1 % 1)"
"({(2,2),(3,3),(<<1,1>,5>,3)},1 % 1)"
"({(2,3),(3,1),(<<1,1>,5>,3)},1 % 1)"
"({(2,3),(3,2),(<<1,1>,5>,3)},1 % 1)"
"({(2,3),(3,3),(<<1,1>,5>,3)},1 % 1)"
"({(2,1),(<<1,1>,2>,0)},1 % 1)"
"({(2,2),(<<1,1>,2>,1)},1 % 1)"
"({(2,3),(<<1,1>,2>,1)},1 % 1)"
"({(3,1),(<<1,1>,3>,0)},1 % 1)"
"({(3,2),(<<1,1>,3>,1)},1 % 1)"
"({(3,3),(<<1,1>,3>,1)},1 % 1)"

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

let aa = hhaa hh

let ff = layerermmxs aa (ind aa) 8 (3^4) 4 4 4 (3^4) 1

Set.size $ ffqq ff
7

rpln $ (concat . map (aall . ttaa) . Set.toList . ffqq) ff
"({(cloud,heavy),(rain,heavy),(<<1,1>,6>,0)},1 % 1)"
"({(cloud,heavy),(rain,light),(<<1,1>,6>,1)},1 % 1)"
"({(cloud,heavy),(rain,none),(<<1,1>,6>,0)},1 % 1)"
"({(cloud,light),(rain,heavy),(<<1,1>,6>,1)},1 % 1)"
"({(cloud,light),(rain,light),(<<1,1>,6>,1)},1 % 1)"
"({(cloud,light),(rain,none),(<<1,1>,6>,1)},1 % 1)"
"({(cloud,none),(rain,heavy),(<<1,1>,6>,0)},1 % 1)"
"({(cloud,none),(rain,light),(<<1,1>,6>,0)},1 % 1)"
"({(cloud,none),(rain,none),(<<1,1>,6>,1)},1 % 1)"
"({(cloud,heavy),(<<1,1>,3>,0)},1 % 1)"
"({(cloud,light),(<<1,1>,3>,1)},1 % 1)"
"({(cloud,none),(<<1,1>,3>,1)},1 % 1)"
"({(pressure,high),(wind,light),(<<1,1>,4>,0)},1 % 1)"
"({(pressure,high),(wind,none),(<<1,1>,4>,0)},1 % 1)"
"({(pressure,high),(wind,strong),(<<1,1>,4>,0)},1 % 1)"
"({(pressure,low),(wind,light),(<<1,1>,4>,3)},1 % 1)"
"({(pressure,low),(wind,none),(<<1,1>,4>,0)},1 % 1)"
"({(pressure,low),(wind,strong),(<<1,1>,4>,3)},1 % 1)"
"({(pressure,medium),(wind,light),(<<1,1>,4>,0)},1 % 1)"
"({(pressure,medium),(wind,none),(<<1,1>,4>,0)},1 % 1)"
"({(pressure,medium),(wind,strong),(<<1,1>,4>,0)},1 % 1)"
"({(pressure,high),(wind,light),(<<1,1>,7>,0)},1 % 1)"
"({(pressure,high),(wind,none),(<<1,1>,7>,0)},1 % 1)"
"({(pressure,high),(wind,strong),(<<1,1>,7>,0)},1 % 1)"
"({(pressure,low),(wind,light),(<<1,1>,7>,3)},1 % 1)"
"({(pressure,low),(wind,none),(<<1,1>,7>,0)},1 % 1)"
"({(pressure,low),(wind,strong),(<<1,1>,7>,3)},1 % 1)"
"({(pressure,medium),(wind,light),(<<1,1>,7>,3)},1 % 1)"
"({(pressure,medium),(wind,none),(<<1,1>,7>,0)},1 % 1)"
"({(pressure,medium),(wind,strong),(<<1,1>,7>,0)},1 % 1)"
"({(pressure,high),(<<1,1>,1>,0)},1 % 1)"
"({(pressure,low),(<<1,1>,1>,1)},1 % 1)"
"({(pressure,medium),(<<1,1>,1>,1)},1 % 1)"
"({(rain,heavy),(<<1,1>,5>,0)},1 % 1)"
"({(rain,light),(<<1,1>,5>,1)},1 % 1)"
"({(rain,none),(<<1,1>,5>,1)},1 % 1)"
"({(wind,light),(<<1,1>,2>,0)},1 % 1)"
"({(wind,none),(<<1,1>,2>,0)},1 % 1)"
"({(wind,strong),(<<1,1>,2>,2)},1 % 1)"

rpln $ aall $ aa `fapply` ff
"({(<<1,1>,1>,0),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,0),(<<1,1>,6>,1),(<<1,1>,7>,0)},1 % 1)"
"({(<<1,1>,1>,0),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,1),(<<1,1>,6>,1),(<<1,1>,7>,0)},5 % 1)"
"({(<<1,1>,1>,0),(<<1,1>,2>,2),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,1),(<<1,1>,6>,1),(<<1,1>,7>,0)},1 % 1)"
"({(<<1,1>,1>,1),(<<1,1>,2>,0),(<<1,1>,3>,0),(<<1,1>,4>,3),(<<1,1>,5>,0),(<<1,1>,6>,0),(<<1,1>,7>,3)},2 % 1)"
"({(<<1,1>,1>,1),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,1),(<<1,1>,6>,0),(<<1,1>,7>,3)},2 % 1)"
"({(<<1,1>,1>,1),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,1),(<<1,1>,6>,1),(<<1,1>,7>,0)},4 % 1)"
"({(<<1,1>,1>,1),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,1),(<<1,1>,6>,1),(<<1,1>,7>,3)},1 % 1)"
"({(<<1,1>,1>,1),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,3),(<<1,1>,5>,1),(<<1,1>,6>,0),(<<1,1>,7>,3)},1 % 1)"
"({(<<1,1>,1>,1),(<<1,1>,2>,2),(<<1,1>,3>,0),(<<1,1>,4>,3),(<<1,1>,5>,0),(<<1,1>,6>,0),(<<1,1>,7>,3)},2 % 1)"
"({(<<1,1>,1>,1),(<<1,1>,2>,2),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,0),(<<1,1>,6>,1),(<<1,1>,7>,0)},1 % 1)"

rpln $ aarr $ (norm (aa `fapply` ff)) `divide` (norm (vvc `fapply` ff))
"({(<<1,1>,1>,0),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,0),(<<1,1>,6>,1),(<<1,1>,7>,0)},2.025)"
"({(<<1,1>,1>,0),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,1),(<<1,1>,6>,1),(<<1,1>,7>,0)},3.375)"
"({(<<1,1>,1>,0),(<<1,1>,2>,2),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,1),(<<1,1>,6>,1),(<<1,1>,7>,0)},1.35)"
"({(<<1,1>,1>,1),(<<1,1>,2>,0),(<<1,1>,3>,0),(<<1,1>,4>,3),(<<1,1>,5>,0),(<<1,1>,6>,0),(<<1,1>,7>,3)},8.1)"
"({(<<1,1>,1>,1),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,1),(<<1,1>,6>,0),(<<1,1>,7>,3)},8.1)"
"({(<<1,1>,1>,1),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,1),(<<1,1>,6>,1),(<<1,1>,7>,0)},2.7)"
"({(<<1,1>,1>,1),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,1),(<<1,1>,6>,1),(<<1,1>,7>,3)},1.35)"
"({(<<1,1>,1>,1),(<<1,1>,2>,0),(<<1,1>,3>,1),(<<1,1>,4>,3),(<<1,1>,5>,1),(<<1,1>,6>,0),(<<1,1>,7>,3)},4.05)"
"({(<<1,1>,1>,1),(<<1,1>,2>,2),(<<1,1>,3>,0),(<<1,1>,4>,3),(<<1,1>,5>,0),(<<1,1>,6>,0),(<<1,1>,7>,3)},8.1)"
"({(<<1,1>,1>,1),(<<1,1>,2>,2),(<<1,1>,3>,1),(<<1,1>,4>,0),(<<1,1>,5>,0),(<<1,1>,6>,1),(<<1,1>,7>,0)},4.05)"


algn (aa `fapply` ff) - algn (ind aa `fapply` ff)
12.661923928835769

algnden (aa `fapply` ff) - algnden (ind aa `fapply` ff)
6.3309619644178845

ent (aa `fapply` ff)
2.108169769053504

cent (fftt ff) aa
0.44551178897629223

rent (aa `fapply` ff) (vvc `fapply` ff)
21.04348700935617

Level limited-layer limited-underlying limited-breadth fud tree searcher

Define the level limited-layer limited-underlying limited-breadth fud tree searcher (Text) \[ Z_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},\mathrm{L}} = \mathrm{searchTreer}(\mathcal{F}_{\infty,U_A,V_A} \cap \mathcal{F}_{\mathrm{u}} \cap \mathcal{F}_{\mathrm{b}} \cap \mathcal{F}_{\mathrm{h}},P_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},\mathrm{L}},\{\emptyset\}) \] where the neighbourhood function returns a singleton \[ \begin{eqnarray} &&P_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},\mathrm{L}}(F) = \{G :\\ &&\hspace{2em}G = F \cup \bigcup\{\{T\} \cup \mathrm{depends}(F_{\mathrm{g}},\mathrm{und}(T)) : \\ &&\hspace{5em}K \in \mathrm{topd}(\lfloor\mathrm{bmax}/\mathrm{mmax}\rfloor)(\mathrm{elements}(Z_{P,A,A_R,V_{\mathrm{g}},F_{\mathrm{g}},F,\mathrm{B}})),\\ &&\hspace{5em}H \in \mathrm{topd}(\mathrm{pmax})(\mathrm{elements}(Z_{P,A,A_R,F \cup F_{\mathrm{g}},\mathrm{n},-,K})),\\ &&\hspace{5em}w \in \mathrm{der}(H),~I = \mathrm{depends}(\mathrm{explode}(H),\{w\}),~T = I^{\mathrm{TPT}}\},\\ &&\hspace{2em}\mathrm{layer}(G, \mathrm{der}(G)) \leq \mathrm{lmax}\} \end{eqnarray} \]

The fud tree search function is defined in module AlignmentPracticable. The implementation replaces partition variables by cardinal variables and so has an additional argument of a list of variables, [Variable]. This implementation is derived from the highest-layer limited-layer limited-underlying limited-breadth fud tree searcher,

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

as

parametersSystemsSamplesShufflesLevelsListVariablesSearcherFudHighest 
  wmax lmax xmax omax bmax mmax umax pmax uu aa aarr vvg ffg ll
  ...
  | ... = Just $ (pp,(uu',ll'))
  | otherwise = Nothing
  where
    qq = ls fudEmpty uu ll lmax 0
    pp = fst $ unzip $ qq
    (uu',ll') = if qq /= [] then (last $ snd $ unzip qq) else (uu,ll)
    ls _ _ _ 0 _ = []
    ls ff uu ll h a = if b > a then ((gg,(uu',ll')) : ls gg uu' ll' (h-1) b) else []
      where
        yy = ls2 (topff (bmax `div` mmax) ff (zzffcstupopt xmax omax uu aa aarr vvg ffg ff)) uu ll
        gg = foldl funion ff (elems (llmm [(rr, ttff tt `funion` depends ffg (und tt)) | 
                                             hh <- (concat $ fst $ unzip yy), 
                                             w <- qqll (fder hh), let tt = fftt (depends hh (sgl w)), 
                                             let rr = ttpp tt, rr `notmem` nn]))
        (uu',ll') = if yy /= [] then (last $ snd $ unzip yy) else (uu,ll)
        b = maxr $ zzffcsdderhighopt wmax omax uu' aa aarr ffg gg
        nn = llqq [ttpp tt | tt <- (qqll . ffqq) ff]
        ls2 [] _ _ = []
        ls2 (kk:bb) uu ll = (top pmax (fst $ unzip xx),(uu',ll')) : ls2 bb uu' ll'
          where
            (xx,(uu',ll')) = zzllcsddecoptw mmax umax pmax uu aa aarr (ff `funion`ffg) kk ll
    zzffcstupopt xmax omax uu aa aarr vvg ffg ff = fst $ unzip $ fromJust $ 
      parametersSystemsSamplesShufflesLevelsFudsFunctionOptimiserTuple xmax omax uu aa aarr vvg ffg ff
    zzllcsddecoptw mmax umax pmax uu aa aarr ff kk ll = fromJust $
      parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionOptimiserFudDecrementingLimitedValency 
        mmax umax pmax uu aa aarr ff kk ll
    zzffcsdderhighopt wmax omax uu aa rr ffg ff = fst $ unzip $ fromJust $ 
      parametersSystemsSamplesShufflesLevelsFudsFunctionOptimiserDerivedHighest wmax omax uu aa rr ffg ff
    ...

Note that this implementation is additionally constrained to be limited-valency.

Level excluded-self maximum-roll highest-layer layerer

The level highest-layer excluded-self maximum-roll layerer, $I_{P,U,\mathrm{L,mr,xs,d,l}}$, is defined in module AlignmentPracticable,

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

as

parametersSystemsLayererLevelMaximumRollExcludedSelfHighest 
  wmax lmax xmax omax bmax mmax umax pmax uu vvg ffg aa aarr f g
  ...
  | otherwise = Just $ layer uu fudEmpty Map.empty xx xxrr 1
  where
    xx = apply (vars aa) (vars aa `union` fvars ffg) (fhis ffg) aa
    xxrr = apply (vars aa) (vars aa `union` fvars ffg) (fhis ffg) aarr
    layer uu ff mm xx xxrr l = 
      if l <= lmax && hh /= fudEmpty && (mm == Map.empty || maxr mm' > maxr mm) then 
        layer uu' gg mm' xx' xxrr' (l+1) else (uu,ff,mm) 
      where
        ll = [(tt,(w,ww)) | (ii,b) <- zip [ii | ((kk,bb,bbrr),y1) <- qqll (buildfftup uu vvg ffg ff xx xxrr), 
               pp <- qqll (parter uu kk bb bbrr y1), nn <- qqll (roller (sgl pp)), ii <- nn, rancd ii < domcd ii] [1..], 
               let w = VarPair (VarPair (VarPair (VarInt f, VarInt g), VarInt l), VarInt b), 
               let ww = Set.map (\(_,u) -> (nnww u)) ii, 
               let tt = trans (unit [ss `sunion` ssgl w (nnww u) | (ss,u) <- qqll ii]) (sgl w)]
        ll' = [(tt,(w,ww)) | (tt,(w,ww)) <- ll, 
                and [Set.size ww /= Set.size ww' || und tt /= und tt' || ttpp tt /= ttpp tt' | (tt',(w',ww')) <- ll, w > w']]
        hh = qqff $ llqq $ fst $ unzip ll'
        uu' = uu `uunion` (lluu $ snd $ unzip ll')
        xx' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xx
        xxrr' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xxrr
        gg = ff `funion` hh `funion` depends ffg (fund hh)
        mm' = buildffdervar uu' (vars aa) ffg gg xx' xxrr'
    buildfftup uu vvg ffg ff xx xxrr = 
      fromJust $ parametersSystemsBuilderTupleLevelNoSumlayerMultiEffective xmax omax bmax mmax uu vvg ffg ff xx xxrr
    parter uu kk bb bbrr y1 = fromJust $ parametersSystemsPartitioner mmax umax pmax uu kk bb bbrr y1
    roller qq = fromJust $ parametersRoller 1 qq
    buildffdervar uu vv ffg ff xx xxrr = llmm $ map (\((kk,_,_),a) -> (kk,a)) $ mmll $ fromJust $
      parametersSystemsBuilderDerivedVarsLevelHighestNoSumlayer wmax omax uu vv ffg ff xx xxrr
  ...

Level excluded-self maximum-roll-by-derived-dimension highest-layer layerer

The level highest-layer excluded-self maximum-roll-by-derived-dimension layerer, $I_{P,U,\mathrm{L,mm,xs,d,l}}$, is defined in module AlignmentPracticable,

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

as

parametersSystemsLayererLevelMaxRollByMExcludedSelfHighest 
  ...
  | otherwise = Just $ layer uu fudEmpty Map.empty xx xxrr 1
  where
    xx = apply (vars aa) (vars aa `union` fvars ffg) (fhis ffg) aa
    xxrr = apply (vars aa) (vars aa `union` fvars ffg) (fhis ffg) aarr
    layer uu ff mm xx xxrr l = 
      if l <= lmax && hh /= fudEmpty && (mm == Map.empty || maxr mm' > maxr mm) then 
        layer uu' gg mm' xx' xxrr' (l+1) else (uu,ff,mm) 
      where
        ll = [(tt,(w,ww)) | (ii,b) <- zip [ii | ((kk,bb,bbrr),y1) <- qqll (buildfftup uu vvg ffg ff xx xxrr), 
               pp <- qqll (parter uu kk bb bbrr y1), nn <- qqll (roller (sgl pp)), ii <- nn, rancd ii < domcd ii] [1..], 
               let w = VarPair (VarPair (VarPair (VarInt f, VarInt g), VarInt l), VarInt b), 
               let ww = Set.map (\(_,u) -> (nnww u)) ii, 
               let tt = trans (unit [ss `sunion` ssgl w (nnww u) | (ss,u) <- qqll ii]) (sgl w)]
        ll' = [(tt,(w,ww)) | (tt,(w,ww)) <- ll, 
                and [Set.size ww /= Set.size ww' || und tt /= und tt' || ttpp tt /= ttpp tt' | (tt',(w',ww')) <- ll, w > w']]
        hh = qqff $ llqq $ fst $ unzip ll'
        uu' = uu `uunion` (lluu $ snd $ unzip ll')
        xx' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xx
        xxrr' = apply (vars xx) (vars xx `union` fvars hh) (fhis hh) xxrr
        gg = ff `funion` hh `funion` depends ffg (fund hh)
        mm' = buildffdervar uu' (vars aa) ffg gg xx' xxrr'
    buildfftup uu vvg ffg ff xx xxrr = 
      fromJust $ parametersSystemsBuilderTupleLevelNoSumlayerMultiEffective xmax omax bmax mmax uu vvg ffg ff xx xxrr
    parter uu kk bb bbrr y1 = fromJust $ parametersSystemsPartitionerMaxRollByM mmax umax pmax uu kk bb bbrr y1
    roller qq = fromJust $ parametersRoller 1 qq
    buildffdervar uu vv ffg ff xx xxrr = llmm $ map (\((kk,_,_),a) -> (kk,a)) $ mmll $ fromJust $
      parametersSystemsBuilderDerivedVarsLevelHighestNoSumlayer wmax omax uu vv ffg ff xx xxrr
  ...

top