Decrementing maximiser

Haskell commentary on the implementation of Tractable and Practicable Inducers/Haskell Implementation/Decrementing maximiser

Sections

Contracted decrementing linear non-overlapping fuds list maximiser

Tuple partitioner

Maximum-roll-by-derived-dimension tuple partitioner

Tuple-partition value roller

Maximum-roll tuple-partition value roller

Contracted decrementing linear non-overlapping fuds list maximiser

See section ‘Optimisation’ P680. Consider the set of transforms of the partition-sets on the tuple $K$ such that the derived variables are pluri-variate and pluri-valent, which avoid necessarily independent derived histograms that have zero alignment. The pluri-valent pluri-limited-tuple-derived-dimension non-overlapping substrate partition-sets set, $\mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}$, is the intersection of the lower-limited-valency substrate partition-sets set, $\mathcal{N}_{U,K,\mathrm{umin}}$, where $\mathrm{umin}=2$, and the range-limited-tuple-derived-dimension non-overlapping substrate partition-sets set, $\mathcal{N}_{U,K,\mathrm{n},\mathrm{mran}}$, where $\mathrm{mran} = (2,\mathrm{mmax})$ and $\mathrm{mmax} \geq 2$, is defined \[ \begin{eqnarray} &&\mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax},\overline{2}} = \\ &&\hspace{2em}\{N : Y \in \mathrm{B}(K),~2 \leq |Y| \leq \mathrm{mmax},~N \in \prod_{J \in Y} (\mathrm{B}(J^{\mathrm{CS}}) \setminus \{\{J^{\mathrm{CS}}\}\})\} \end{eqnarray} \] In the case where $\mathrm{mmax} \leq |K|$, the cardinality is \[ \begin{eqnarray} &&|\mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}| = \\ &&\hspace{2em}\sum \Big(\prod_{J \in Y} (\mathrm{bell}(|J^{\mathrm{CS}}|)-1)\Big) : m \in \{2 \ldots \mathrm{mmax}\},~Y \in \mathrm{S}(K,m) \end{eqnarray} \] In the case of regular variables $K$, having valency $d$ and dimension $k$, the cardinality of the pluri-valent pluri-limited-tuple-derived-dimension non overlapping substrate partition-sets set is \[ \begin{eqnarray} &&|\mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}| = \\ &&\hspace{2em}\sum \Big(a \prod_{(j,p) \in L} (\mathrm{bell}(d^j)-1)^p \Big) : m \in \{2 \ldots \mathrm{mmax}\},~(L,a) \in \mathrm{stircd}(k,m) \end{eqnarray} \] where the fixed cardinality partition function cardinality function is $\mathrm{stircd} \in \mathbf{N}_{>0} \times \mathbf{N}_{>0} \to (\mathcal{L}(\mathbf{N}) \to \mathbf{N})$. The regular cardinality is defined in module AlignmentSubstrate,

valenciesDimensionsLimitsSetSetPartitionSubstrateNonOverlapPluriLimitedBreadthPluriValentCardReg :: 
  Integer -> Integer -> Integer -> Maybe Integer

as

valenciesDimensionsLimitsSetSetPartitionSubstrateNonOverlapPluriLimitedBreadthPluriValentCardReg d n bmax
  | ... = Just $ 
      sum [c * product [(bell (d^k) - 1)^m | (k,m) <- zip [1..] ll] | (ll,c) <- sscdlimpvll n (min n bmax)]
  | otherwise = Nothing
  where
    sscdlimpvll n k = Map.toList $ Map.filterWithKey (\kk _ -> sum kk > 1 && sum kk <= k) (bellcd n)

For example,

let nnvvnpbmaxpvcdr d n bmax = fromJust $ valenciesDimensionsLimitsSetSetPartitionSubstrateNonOverlapPluriLimitedBreadthPluriValentCardReg d n bmax

[(d, n, bmax, nnvvnpbmaxpvcdr d n bmax) | n <- [2..3], d <- [2..4], bmax <- [2..3]]
[(2,2,2,1),(2,2,3,1),(3,2,2,16),(3,2,3,16),(4,2,2,196),(4,2,3,196),(2,3,2,42),(2,3,3,43),(3,3,2,253752),(3,3,3,253816),(4,3,2,440165970132),(4,3,3,440165972876)]

In the case where computational resources are still exceeded by the cardinality of this set, $|\mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}|$, consider searches restricted to subsets of the transforms of the pluri-valent pluri-limited-tuple-derived-dimension non-overlapping substrate partition-sets set, $\mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}$.

Consider an optimisation where the search is broken into two separate searches. The first search determines the partition of the tuple, $Y$, by searching the transforms of the intersection of the substrate self-cartesian partition-sets set, $\mathcal{N}_{U,K,\mathrm{c} }$, and the pluri-limited-tuple-derived-dimension non-overlapping substrate transforms set, $\mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b} },\mathrm{mmax} }$, where $2 \leq \mathrm{mmax} \leq |K|$, which is \[ \mathcal{N}_{U,K,\mathrm{c} } \cap \mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b} },\mathrm{mmax} } = \{\{J^{\mathrm{CS}\{\} } : J \in Y\} : m \in \{2 \ldots \mathrm{mmax}\},~Y \in \mathrm{S}(K,m)\} \] The cardinality of the intersection is \[ |\mathcal{N}_{U,K,\mathrm{c}} \cap \mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax}}|= \sum_{m \in \{2 \ldots \mathrm{mmax}\}} \mathrm{stir}(|K|,m) \] The intersection is defined in module AlignmentSubstrate,

dimensionsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthCardinalityRegular :: 
  Integer -> Integer -> Integer

as

dimensionsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthCardinalityRegular n bmax =
  sum [stirlingSecond n b | b <- [2 .. (min n bmax)]]

For example,

let nnvvncpbmaxcdr n bmax = dimensionsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthCardinalityRegular n bmax

[(n,bmax,nnvvncpbmaxcdr n bmax) | n <- [2..5], bmax <- [2..5]]
[(2,2,1),(2,3,1),(2,4,1),(2,5,1),(3,2,3),(3,3,4),(3,4,4),(3,5,4),(4,2,7),(4,3,13),(4,4,14),(4,5,14),(5,2,15),(5,3,40),(5,4,50),(5,5,51)]

The tuple partition search is optimised by maximising the shuffle content alignment valency-density, (Text) \[ \begin{eqnarray} &&Y \in \mathrm{maxd}(\{(Z,(\mathrm{algn}(A * G^{\mathrm{T} })-\mathrm{algn}(A_R * G^{\mathrm{T} }))/\mathrm{cvl}(G)) : \\ &&\hspace{8em}m \in \{2 \ldots \mathrm{mmax}\},~Z \in \mathrm{S}(K,m),\\ &&\hspace{8em}N = \{J^{\mathrm{CS}\{\} } : J \in Z\},~G = \mathrm{depends}(F \cup \{N^{\mathrm{T} }\},N)\}) \end{eqnarray} \] The tuple partition search function is defined in module AlignmentPracticable,

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

as

parametersSystemsSamplesShufflesFudsSetVarsFunctionSearchTuplePartition mmax uu aa aarr ff kk
  | mmax < 0 = Nothing
  | ... = Just $ llmm 
      [(zz, (algn (aa `fmul` gg) - algn (aarr `fmul` gg)) / (w' ** (1/m))) |
        zz <- stirsll kk mmax, dim zz >= 2,
        let gg = depends ff kk `funion` llff [pptt (self uu jj) | jj <- qqll zz],
        let ww = fder gg, let w = vol (uu `uunion` fsys gg) ww,
        let w' = fromIntegral w, let m = fromIntegral (Set.size ww)]
  | otherwise = Nothing
  where
    ...
    stirsll vv bmax = Set.toList $ setsSetPartitionLimited vv bmax
    ...

For example,

let zzcsdyy aa rr mmax = fromJust $ parametersSystemsSamplesShufflesFudsSetVarsFunctionSearchTuplePartition mmax (sys aa) aa rr fudEmpty (vars aa)


nnvvncpbmaxcdr 3 3
4

let aa = resize 90 $ regpivot 3 2 `mul` regtranspose [3] (regcart 3 1)

rpln $ aall $ resize 90 $ regpivot 3 2
"({(1,1),(2,1)},18 % 1)"
"({(1,2),(2,2)},18 % 1)"
"({(1,2),(2,3)},18 % 1)"
"({(1,3),(2,2)},18 % 1)"
"({(1,3),(2,3)},18 % 1)"

rpln $ aall aa
"({(1,1),(2,1),(3,1)},6 % 1)"
"({(1,1),(2,1),(3,2)},6 % 1)"
"({(1,1),(2,1),(3,3)},6 % 1)"
"({(1,2),(2,2),(3,1)},6 % 1)"
"({(1,2),(2,2),(3,2)},6 % 1)"
"({(1,2),(2,2),(3,3)},6 % 1)"
"({(1,2),(2,3),(3,1)},6 % 1)"
"({(1,2),(2,3),(3,2)},6 % 1)"
"({(1,2),(2,3),(3,3)},6 % 1)"
"({(1,3),(2,2),(3,1)},6 % 1)"
"({(1,3),(2,2),(3,2)},6 % 1)"
"({(1,3),(2,2),(3,3)},6 % 1)"
"({(1,3),(2,3),(3,1)},6 % 1)"
"({(1,3),(2,3),(3,2)},6 % 1)"
"({(1,3),(2,3),(3,3)},6 % 1)"

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsdyy aa (ind aa) 3
"(0,(0.0,{ {1,2},{3} }))"
"(1,(6.137371702752476,{ {1},{2,3} }))"
"(2,(6.137371702752478,{ {1,3},{2} }))"
"(3,(10.6302396141028,{ {1},{2},{3} }))"

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsdyy aa (ind aa) 2
"(0,(0.0,{ {1,2},{3} }))"
"(1,(6.137371702752476,{ {1},{2,3} }))"
"(2,(6.137371702752478,{ {1,3},{2} }))"

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsdyy aa (ind aa) 1

nnvvncpbmaxcdr 4 4
14

let aa = resize 100 $ regpivot 3 4

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsdyy aa (ind aa) 4
"(0,(1.5947228147011998,{ {1},{2,3,4} }))"
"(1,(1.5947228147011998,{ {1,2,3},{4} }))"
"(2,(1.5947228147011998,{ {1,2,4},{3} }))"
"(3,(1.5947228147011998,{ {1,3,4},{2} }))"
"(4,(1.6597114205035395,{ {1,2},{3,4} }))"
"(5,(1.6597114205035395,{ {1,3},{2,4} }))"
"(6,(1.6597114205035395,{ {1,4},{2,3} }))"
"(7,(6.294799164299963,{ {1},{2},{3,4} }))"
"(8,(6.294799164299963,{ {1},{2,3},{4} }))"
"(9,(6.294799164299963,{ {1},{2,4},{3} }))"
"(10,(6.294799164299963,{ {1,2},{3},{4} }))"
"(11,(6.294799164299963,{ {1,3},{2},{4} }))"
"(12,(6.294799164299963,{ {1,4},{2},{3} }))"
"(13,(12.888371376843972,{ {1},{2},{3},{4} }))"

In this case the tuple partition, $Y$, is just the self-partition, $K^{\{\}}$, because $\mathrm{mmax}$ is effectively unlimited.

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

let aa = hhaa hh

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsdyy aa (ind aa) 2
"(0,(0.5837680191252497,{ {cloud,pressure,rain},{wind} }))"
"(1,(0.7709893150145191,{ {cloud,rain,wind},{pressure} }))"
"(2,(0.8139736851717501,{ {cloud},{pressure,rain,wind} }))"
"(3,(0.9390100351220398,{ {cloud,pressure,wind},{rain} }))"
"(4,(0.943379728848379,{ {cloud,pressure},{rain,wind} }))"
"(5,(1.0076354978077768,{ {cloud,wind},{pressure,rain} }))"
"(6,(1.0277553712872054,{ {cloud,rain},{pressure,wind} }))"

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsdyy aa (ind aa) 3
"(0,(0.5837680191252497,{ {cloud,pressure,rain},{wind} }))"
"(1,(0.7709893150145191,{ {cloud,rain,wind},{pressure} }))"
"(2,(0.8139736851717501,{ {cloud},{pressure,rain,wind} }))"
"(3,(0.9390100351220398,{ {cloud,pressure,wind},{rain} }))"
"(4,(0.943379728848379,{ {cloud,pressure},{rain,wind} }))"
"(5,(1.0076354978077768,{ {cloud,wind},{pressure,rain} }))"
"(6,(1.0277553712872054,{ {cloud,rain},{pressure,wind} }))"
"(7,(2.211185476441681,{ {cloud,rain},{pressure},{wind} }))"
"(8,(2.3534510532151653,{ {cloud},{pressure,rain},{wind} }))"
"(9,(2.363216604304876,{ {cloud,pressure},{rain},{wind} }))"
"(10,(2.426316619790977,{ {cloud},{pressure},{rain,wind} }))"
"(11,(2.5392868497290304,{ {cloud,wind},{pressure},{rain} }))"
"(12,(2.686485040395303,{ {cloud},{pressure,wind},{rain} }))"

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsdyy aa (ind aa) 4
"(0,(0.5837680191252497,{ {cloud,pressure,rain},{wind} }))"
"(1,(0.7709893150145191,{ {cloud,rain,wind},{pressure} }))"
"(2,(0.8139736851717501,{ {cloud},{pressure,rain,wind} }))"
"(3,(0.9390100351220398,{ {cloud,pressure,wind},{rain} }))"
"(4,(0.943379728848379,{ {cloud,pressure},{rain,wind} }))"
"(5,(1.0076354978077768,{ {cloud,wind},{pressure,rain} }))"
"(6,(1.0277553712872054,{ {cloud,rain},{pressure,wind} }))"
"(7,(2.211185476441681,{ {cloud,rain},{pressure},{wind} }))"
"(8,(2.3534510532151653,{ {cloud},{pressure,rain},{wind} }))"
"(9,(2.363216604304876,{ {cloud,pressure},{rain},{wind} }))"
"(10,(2.426316619790977,{ {cloud},{pressure},{rain,wind} }))"
"(11,(2.5392868497290304,{ {cloud,wind},{pressure},{rain} }))"
"(12,(2.686485040395303,{ {cloud},{pressure,wind},{rain} }))"
"(13,(3.9502840911392316,{ {cloud},{pressure},{rain},{wind} }))"

The weather forecast example continues in Contracted decrementing linear non-overlapping fuds list maximiser initial subset.

Then, given the partition, $Y$, of the tuple, the second search, optimised by shuffle content alignment valency-density, is (Text) \[ \begin{eqnarray} &&Q = \mathrm{topd}(\mathrm{pmax})(\{(N^{\mathrm{T} },(\mathrm{algn}(A * G^{\mathrm{T} })-\mathrm{algn}(A_R * G^{\mathrm{T} }))/\mathrm{cvl}(G)) : \\ &&\hspace{5em}N \in \prod_{J \in Y} (\mathrm{B}(J^{\mathrm{CS} }) \setminus \{\{J^{\mathrm{CS} }\}\}),~G = \mathrm{depends}(F \cup \{N^{\mathrm{T} }\},N)\}) \end{eqnarray} \] The cardinality of the transform search is \[ \prod_{J \in Y} (\mathrm{bell}(|J^{\mathrm{CS}}|)-1) \] The cardinality function is defined in module AlignmentSubstrate,

systemsSetVarsSubstratePartitionsSetSetPartitionSubstrateNonOverlapPluriValentCardinality :: 
  System -> Set.Set Variable -> Set.Set (Set.Set Variable) -> Maybe Integer

as

systemsSetVarsSubstratePartitionsSetSetPartitionSubstrateNonOverlapPluriValentCardinality uu vv yy
  ...
  | ... = Just $ product [bell (vol uu kk) - 1 | kk <- qqll yy]
  | otherwise = Nothing
  where
    ...

The transform search function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesFudsSubstratePartitionsFunctionSearchNonOverlapTransform :: 
  System -> Histogram -> Histogram -> Fud -> Set.Set (Set.Set Variable) -> 
  Maybe (Map.Map Transform Double)

as

parametersSystemsSamplesShufflesFudsSubstratePartitionsFunctionSearchNonOverlapTransform uu aa aarr ff yy
  | ... = Just $ llmm 
      [(nntt nn, (algn (aa `fmul` gg) - algn (aarr `fmul` gg)) / (w' ** (1/m))) | 
        mm <- qqll (prod [partspl (cart uu jj) | jj <- qqll yy]),
        let nn = llqq [qqpp qq | qq <- mm],
        let gg = depends ff (bigcup yy) `funion` ttff (nntt nn),
        let ww = fder gg, let w = vol (uu `uunion` fsys gg) ww,  
        let w' = fromIntegral w, let m = fromIntegral (Set.size ww)]
  | otherwise = Nothing
  where
    ...

In the following examples, the derived partition variables are replaced with a sequence of cardinal variables, by using the fud reframe function fmpi defined in module AlignmentDev,

let umap uu ll = Map.fromList [(v,(v',Map.fromList (zip (Set.toList ww) (map ValInt [1..])))) | ((v,ww),v') <- zip [(v,ww) | (v,ww) <- uull uu, variablesIsPartition v] ll]
    fmp ff ll = qqff (Set.map (\tt -> fromJust (transformsMapVarMapValsFrame tt (umap (fsys ff) ll))) (ffqq ff))
    fmpi ff = fmp ff [VarInt i | i <- [1..], VarInt i `Set.notMember` fvars ff]

For example,

let zzcsdyy aa rr mmax = fromJust $ parametersSystemsSamplesShufflesFudsSetVarsFunctionSearchTuplePartition mmax (sys aa) aa rr fudEmpty (vars aa)

let nnvvnpvyycd aa yy = fromJust $ systemsSetVarsSubstratePartitionsSetSetPartitionSubstrateNonOverlapPluriValentCardinality (sys aa) (vars aa) yy

let ppcsdtn aa rr yy = fromJust $ parametersSystemsSamplesShufflesFudsSubstratePartitionsFunctionSearchNonOverlapTransform (sys aa) aa rr fudEmpty yy

let aa = resize 90 $ regpivot 3 2 `mul` regtranspose [3] (regcart 3 1)

rpln $ zip [0.. ] $ sort $ map (\(yy,a) -> (a, yy, nnvvnpvyycd aa yy)) $ Map.toList $ zzcsdyy aa (ind aa) 3
"(0,(0.0,{ {1,2},{3} },84584))"
"(1,(6.137371702752476,{ {1},{2,3} },84584))"
"(2,(6.137371702752478,{ {1,3},{2} },84584))"
"(3,(10.6302396141028,{ {1},{2},{3} },64))"

let (_,yy) = last $ sort $ map (\(yy,a) -> (a, yy)) $ Map.toList $ zzcsdyy aa (ind aa) 3

rp yy
"{ {1},{2},{3} }"

The tuple partition, $Y$, is just the self-partition in this case.

nnvvnpvyycd aa yy
64

Map.size $ ppcsdtn aa (ind aa) yy
64

let (a,ff) = last $ sort $ map (\(tt,a) -> (a,fmpi (ttff tt))) $ Map.toList $ ppcsdtn aa (ind aa) yy

a
19.613781801671664

rpln $ aall $ ttaa (fftt ff)

let red aa ll = setVarsHistogramsReduce (Set.fromList ll) aa

rpln $ aall $ ttaa (fftt ff) `red` (map VarInt [1,4])
"({(1,1),(4,1)},9 % 1)"
"({(1,2),(4,2)},9 % 1)"
"({(1,3),(4,2)},9 % 1)"

rpln $ aall $ ttaa (fftt ff) `red` (map VarInt [2,5])
"({(2,1),(5,1)},9 % 1)"
"({(2,2),(5,2)},9 % 1)"
"({(2,3),(5,2)},9 % 1)"

The transform search function then rolls the values 2 and 3 of the pivot variables, 1 and 2, into the derived value 2 of derived variables 4 and 5.

In the case where mmax is limited to 2, the transform search function would take much longer,

let (_,yy) = last $ sort $ map (\(yy,a) -> (a, yy)) $ Map.toList $ zzcsdyy aa (ind aa) 2

rp yy
"{ {1,3},{2} }"

nnvvnpvyycd aa yy
84584

Instead of a subset of the transforms of the pluri-valent pluri-limited-tuple-derived-dimension non-overlapping substrate partition-sets of the tuple, $Q \subset \{N^{\mathrm{T}} : N \in \mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}\}$, consider a subset of the pluri-valent pluri-limited-tuple-derived-dimension contracted decrementing linear non-overlapping fuds of the tuple $Q \subset \mathcal{F}_{U_A,\mathrm{n},-,K,\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}$ such that $|Q| \leq \mathrm{pmax}$. The pluri-valent pluri-limited-tuple-derived-dimension contracted decrementing linear non-overlapping fuds is defined \[ \begin{eqnarray} &&\mathcal{F}_{U,\mathrm{n},-,K,\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}\\ &&\hspace{2em}=\{\{N^{\mathrm{T}} : (\cdot,N) \in L\} : M \in \mathcal{N}_{U,K,\mathrm{c}} \cap \mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax}},\\ &&\hspace{10em}L \in \mathrm{subpaths}(\{(M,\mathrm{tdecp}(U)(M))\})\} \\ &&\hspace{2em}=\{\{N^{\mathrm{T}} : (\cdot,N) \in L\} : Y \in \mathrm{B}(K),~2 \leq |Y| \leq \mathrm{mmax},~M = \{J^{\mathrm{CS}\{\}} : J \in Y\},\\ &&\hspace{10em}L \in \mathrm{subpaths}(\{(M,\mathrm{tdecp}(U)(M))\})\} \end{eqnarray} \] where $\mathrm{mmax} \geq 2$ and the tree of pluri-valent self non-overlapping substrate decremented partition-sets is defined $\mathrm{tdecp}(U) \in \mathrm{P}(\mathcal{V}_U) \to \mathrm{trees}(\mathrm{P}(\mathcal{R}_U))$ as \[ \mathrm{tdecp}(U)(M) := \{(N,\mathrm{tdecp}(U)(N)) : N \in \mathcal{N}_{U,M,\overline{2}} \cap \mathcal{N}_{U,M,-} \cap \mathcal{N}_{U,M,\mathrm{n,s}}\} \] and $\mathrm{tdecp}(U)(\emptyset) :=\emptyset$. Explicitly this is \[ \begin{eqnarray} &&\mathrm{tdecp}(U)(M) := \{(N,\mathrm{tdecp}(U)(N)) :\\ &&\hspace{10em}w \in M,~|\{w\}^{\mathrm{C}}| > 2,~Q \in \mathrm{decs}(\{w\}^{\mathrm{CS}\{\}}),\\ &&\hspace{10em}N = \{Q\} \cup \{\{u\}^{\mathrm{CS}\{\}} : u \in M,~u \neq w\}\} \end{eqnarray} \] where \[ \mathrm{decs}(P) = \{P \setminus \{C,D\} \cup \{C \cup D\} : C,D \in P,~C \neq D\} \] The choice of tuple fuds, $Q \subset \mathcal{F}_{U_A,\mathrm{n},-,K,\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}$, is made by maximising the shuffle content alignment valency-density, \[ \begin{eqnarray} &&Q = \mathrm{topd}(\mathrm{pmax})(\{(H,(\mathrm{algn}(A * G^{\mathrm{T}})-\mathrm{algn}(A_R * G^{\mathrm{T}}))/\mathrm{cvl}(G)) : \\ &&\hspace{5em}H \in \mathcal{F}_{U_A,\mathrm{n},-,K,\overline{\mathrm{b}},\mathrm{mmax},\overline{2}},~G = \mathrm{depends}(F \cup H,\mathrm{der}(H))\}) \end{eqnarray} \] The cardinality of the contracted decrementing linear non-overlapping fuds is greater than or equal to the cardinality of the non-overlapping substrate transforms, $|\mathcal{F}_{U,\mathrm{n},-,K,\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}| \geq |\mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}|$, so the computation time is increased. However, consider the optimisation of the tree of decrements. See section ‘Optimisation’ P689. Define the contracted decrementing linear non-overlapping fuds list maximiser \[ \begin{eqnarray} &&Z_{P,A,A_R,F,\mathrm{n},-,K} =\\ &&\hspace{2em}\mathrm{maximiseLister}(X_{P,A,A_R,F,\mathrm{n},-,K},N_{P,A,A_R,F,\mathrm{n},-,K},\mathrm{top}(\mathrm{pmax}),R_{P,A,A_R,F,\mathrm{n},-,K}) \end{eqnarray} \] The contracted decrementing linear non-overlapping fuds list maximiser optimiser function is \[ \begin{eqnarray} &&X_{P,A,A_R,F,\mathrm{n},-,K} = \{(H,(I_{\mathrm{a}}^{ * }(A * G^{\mathrm{T}})-I_{\mathrm{a}}^{ * }(A_R * G^{\mathrm{T}}))/I_{\mathrm{cvl}}^{ * }(G)) : \\ &&\hspace{10em}H \in \mathcal{F}_{U_A,\mathrm{n},-,K,\overline{\mathrm{b}},\mathrm{mmax},\overline{2}},~G = \mathrm{depends}(F \cup H,\mathrm{der}(H))\} \end{eqnarray} \] The contracted decrementing linear non-overlapping fuds list maximiser initial subset is (Text) \[ \begin{eqnarray} &&R_{P,A,A_R,F,\mathrm{n},-,K} = \{(\{M^{\mathrm{T}}\},X_{P,A,A_R,F,\mathrm{n},-,K}(\{M^{\mathrm{T}}\})) : \\ &&\hspace{10em}Y \in \mathrm{B}(K),~2 \leq |Y| \leq \mathrm{mmax},~M = \{J^{\mathrm{CS}\{\}} : J \in Y\}\} \end{eqnarray} \] The cardinality of the initial set is \[ \begin{eqnarray} |R_{P,A,A_R,F,\mathrm{n},-,K}| &=& |\mathcal{N}_{U,K,\mathrm{c}} \cap \mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax}}| \\ &=& \sum_{m \in \{2 \ldots \mathrm{mmax}\}} \mathrm{stir}(|K|,m) \\ &\leq& \mathrm{bell}(|K|)-1 \end{eqnarray} \] The initial subset function is defined in module AlignmentPracticable,

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

as

parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementing mmax uu aa aarr ff kk
  | mmax < 0 = Nothing
  | ... = Just $ llmm 
      [(ttff (nntt nn), (algn (aa `fmul` gg) - algn (aarr `fmul` gg)) / (w' ** (1/m))) |
        zz <- stirsll kk mmax, dim zz >= 2,
        let nn = llqq [self uu jj | jj <- qqll zz],
        let gg = depends ff kk `funion` ttff (nntt nn),
        let ww = fder gg, let w = vol (uu `uunion` fsys gg) ww,
        let w' = fromIntegral w, let m = fromIntegral (Set.size ww)]
  | otherwise = Nothing
  where
    ...
    stirsll vv bmax = Set.toList $ setsSetPartitionLimited vv bmax
    ...

For example,

let nnvvncpbmaxcdr n bmax = dimensionsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthCardinalityRegular n bmax

let zzcsddecinit aa rr mmax = fromJust $ parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementing mmax (sys aa) aa rr fudEmpty (vars aa)

let aa = resize 90 $ regpivot 3 2 `mul` regtranspose [3] (regcart 3 1)

nnvvncpbmaxcdr 3 4
4

rpln $ zip [0.. ] $ sort $ map (\(ff,a) -> (a, fmpi ff)) $ Map.toList $ zzcsddecinit aa (ind aa) 4

rpln $ zip [0.. ] $ sort $ map (\(ff,a) -> (a, fder (fmpi ff))) $ Map.toList $ zzcsddecinit aa (ind aa) 4
"(0,(0.0,{4,5}))"
"(1,(6.137371702752476,{4,5}))"
"(2,(6.137371702752478,{4,5}))"
"(3,(10.6302396141028,{4,5,6}))"

let aa = resize 100 $ regpivot 3 4

nnvvncpbmaxcdr 4 4
14

rpln $ zip [0.. ] $ sort $ map (\(ff,a) -> (a,fmpi ff)) $ Map.toList $ zzcsddecinit aa (ind aa) 4

rpln $ zip [0.. ] $ sort $ map (\(ff,a) -> (a, fder (fmpi ff))) $ Map.toList $ zzcsddecinit aa (ind aa) 4
"(0,(1.5947228147011998,{5,6}))"
"(1,(1.5947228147011998,{5,6}))"
"(2,(1.5947228147011998,{5,6}))"
"(3,(1.5947228147011998,{5,6}))"
"(4,(1.6597114205035395,{5,6}))"
"(5,(1.6597114205035395,{5,6}))"
"(6,(1.6597114205035395,{5,6}))"
"(7,(6.294799164299963,{5,6,7}))"
"(8,(6.294799164299963,{5,6,7}))"
"(9,(6.294799164299963,{5,6,7}))"
"(10,(6.294799164299963,{5,6,7}))"
"(11,(6.294799164299963,{5,6,7}))"
"(12,(6.294799164299963,{5,6,7}))"
"(13,(12.888371376843972,{5,6,7,8}))"

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

let aa = hhaa hh

rpln $ zip [0.. ] $ sort $ map (\(ff,a) -> (a, fder (fmpi ff))) $ Map.toList $ zzcsddecinit aa (ind aa) 2
"(0,(0.5837680191252497,{1,2}))"
"(1,(0.7709893150145191,{1,2}))"
"(2,(0.8139736851717501,{1,2}))"
"(3,(0.9390100351220398,{1,2}))"
"(4,(0.943379728848379,{1,2}))"
"(5,(1.0076354978077768,{1,2}))"
"(6,(1.0277553712872054,{1,2}))"

rpln $ zip [0.. ] $ sort $ map (\(ff,a) -> (a, fder (fmpi ff))) $ Map.toList $ zzcsddecinit aa (ind aa) 3
"(0,(0.5837680191252497,{1,2}))"
...
"(6,(1.0277553712872054,{1,2}))"
"(7,(2.211185476441682,{1,2,3}))"
"(8,(2.353451053215166,{1,2,3}))"
"(9,(2.3632166043048763,{1,2,3}))"
"(10,(2.4263166197909776,{1,2,3}))"
"(11,(2.5392868497290313,{1,2,3}))"
"(12,(2.686485040395304,{1,2,3}))"

rpln $ zip [0.. ] $ sort $ map (\(ff,a) -> (a, fder (fmpi ff))) $ Map.toList $ zzcsddecinit aa (ind aa) 4
"(0,(0.5837680191252497,{1,2}))"
...
"(12,(2.686485040395304,{1,2,3}))"
"(13,(3.9502840911392316,{1,2,3,4}))"

The weather forecast example continues in Contracted decrementing linear non-overlapping fuds list maximiser neighbourhood function.

The contracted decrementing linear non-overlapping fuds list maximiser the neighbourhood function is (Text) \[ \begin{eqnarray} &&N_{P,A,A_R,F,\mathrm{n},-,K}(C) = \{(H \cup \{N^{\mathrm{T}}\},X_{P,A,A_R,F,\mathrm{n},-,K}(H \cup \{N^{\mathrm{T}}\})) :\\ &&\hspace{10em}(H,\cdot) \in C,~M = \mathrm{der}(H),\\ &&\hspace{10em}w \in M,~|\{w\}^{\mathrm{C}}| > 2,~Q \in \mathrm{decs}(\{w\}^{\mathrm{CS}\{\}}),\\ &&\hspace{10em}N = \{Q\} \cup \{\{u\}^{\mathrm{CS}\{\}} : u \in M,~u \neq w\}\} \end{eqnarray} \] The neighbourhood function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesFudsFunctionsFunctionNeighbourhoodFudDecrementing :: 
  System -> Histogram -> Histogram -> Fud -> Map.Map Fud Double -> Maybe (Map.Map Fud Double)

as

parametersSystemsSamplesShufflesFudsFunctionsFunctionNeighbourhoodFudDecrementing uu aa aarr ff qq
  | ... = Just $ llmm 
      [(hh `funion` ttff (nntt nn), (algn (aa `fmul` gg) - algn (aarr `fmul` gg)) / (w' ** (1/m))) | 
        hh <- keys qq, let uu' = (uu `uunion` fsys hh),
        x <- qqll (fder hh), ucard uu' x > 2, qq <- decsll (self uu' x),
        let nn = llqq ([qq] ++ [self uu' u | u <- qqll (fder hh), u /= x]),
        let gg = depends ff (fund hh) `funion` hh `funion` ttff (nntt nn),
        let ww = fder gg, let w = vol (uu `uunion` fsys gg) ww,  
        let w' = fromIntegral w, let m = fromIntegral (Set.size ww)]
  | otherwise = Nothing
  where  
    ...
    decsll pp = Set.toList $ Set.map qqpp $ partitionSetsDecrements $ ppqq pp
    ...

For example,

let zzcsdyy aa rr mmax = fromJust $ parametersSystemsSamplesShufflesFudsSetVarsFunctionSearchTuplePartition mmax (sys aa) aa rr fudEmpty (vars aa)

let zzcsddecinit aa rr mmax = fromJust $ parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementing mmax (sys aa) aa rr fudEmpty (vars aa)

let zzcsddecneigh aa rr hh a = fromJust $ parametersSystemsSamplesShufflesFudsFunctionsFunctionNeighbourhoodFudDecrementing (sys aa) aa rr fudEmpty (Map.singleton hh a)

let aa = resize 90 $ regpivot 3 2 `mul` regtranspose [3] (regcart 3 1)

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsdyy aa (ind aa) 3
"(0,(0.0,{ {1,2},{3} }))"
"(1,(6.137371702752476,{ {1},{2,3} }))"
"(2,(6.137371702752478,{ {1,3},{2} }))"
"(3,(10.6302396141028,{ {1},{2},{3} }))"

Again, the partition of the tuple with the highest alignment valency-density is just the self-partition, $K^{\{\}}$. The corresponding transform is just the reframe,

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,fmpi a)) $ Map.toList $ zzcsddecinit aa (ind aa) 3

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecinit aa (ind aa) 3

algn $ aa
31.890718842308402

algn $ aa `tmul` (fftt hh)
31.890718842308402

rpln $ aall $ ttaa $ fftt $ fmpi hh
"({(1,1),(2,1),(3,1),(4,1),(5,1),(6,1)},1 % 1)"
"({(1,1),(2,1),(3,2),(4,1),(5,1),(6,2)},1 % 1)"
"({(1,1),(2,1),(3,3),(4,1),(5,1),(6,3)},1 % 1)"
"({(1,1),(2,2),(3,1),(4,1),(5,2),(6,1)},1 % 1)"
"({(1,1),(2,2),(3,2),(4,1),(5,2),(6,2)},1 % 1)"
...
"({(1,3),(2,2),(3,1),(4,3),(5,2),(6,1)},1 % 1)"
"({(1,3),(2,2),(3,2),(4,3),(5,2),(6,2)},1 % 1)"
"({(1,3),(2,2),(3,3),(4,3),(5,2),(6,3)},1 % 1)"
"({(1,3),(2,3),(3,1),(4,3),(5,3),(6,1)},1 % 1)"
"({(1,3),(2,3),(3,2),(4,3),(5,3),(6,2)},1 % 1)"
"({(1,3),(2,3),(3,3),(4,3),(5,3),(6,3)},1 % 1)"

So the cardinality of the neighbourhood of this regular reframe is $|N_{P,A,A_R,F,\mathrm{n},-,K}(C)| = nd(d-1)/2$,

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

Map.size $ zzcsddecneigh aa (ind aa) hh a
9

rpln $ zip [0.. ] $ sort $ map snd $ Map.toList $ zzcsddecneigh aa (ind aa) hh a
"(0,2.8026431226723085)"
"(1,2.8026431226723085)"
"(2,2.802643122672314)"
"(3,2.802643122672314)"
"(4,13.140507788508302)"
"(5,13.140507788508312)"
"(6,13.350624478517439)"
"(7,13.350624478517439)"
"(8,13.350624478517457)"

let (a2,hh2) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) hh a) !! 8

rpln $ aall $ ttaa $ fftt $ fmpi hh2

rpln $ aall $ (ttaa $ fftt $ fmpi hh2) `red`  (map VarInt [3,9])
"({(3,1),(9,1)},9 % 1)"
"({(3,2),(9,2)},9 % 1)"
"({(3,3),(9,2)},9 % 1)"

The neighbouring fud with the highest alignment valency-density, rolls the cartesian tri-valent variable 3 to a bi-valent derived variable 9.

let (a2,hh2) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) hh a) !! 5

rpln $ aall $ ttaa $ fftt $ fmpi hh2

rpln $ aall $ (ttaa $ fftt $ fmpi hh2) `red`  (map VarInt [1,7])
"({(1,1),(7,1)},9 % 1)"
"({(1,2),(7,2)},9 % 1)"
"({(1,3),(7,2)},9 % 1)"

This is only slightly worse because the non-pivot values 2 and 3 of variable 1 are rolled together.

let (a2,hh2) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) hh a) !! 3

rpln $ aall $ ttaa $ fftt $ fmpi hh2

rpln $ aall $ (ttaa $ fftt $ fmpi hh2) `red`  (map VarInt [2,8])
"({(2,1),(8,1)},9 % 1)"
"({(2,2),(8,2)},9 % 1)"
"({(2,3),(8,1)},9 % 1)"

The worst rolls include the pivot value 1 of variables 1 or 2.

Now consider the sequence of neighbourhoods,

let (a2,hh2) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) hh a) !! 8

rpln $ aall $ ttaa $ fftt $ fmpi hh2

rpln $ aall $ (ttaa $ fftt $ fmpi hh2) `red`  (map VarInt [3,9])
"({(3,1),(9,1)},9 % 1)"
"({(3,2),(9,2)},9 % 1)"
"({(3,3),(9,2)},9 % 1)"

The next neighbourhood cardinality of the remaining tri-valent variables, 7 and 8, of the regular reframe is $(n-1)d(d-1)/2$,

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

Map.size $ zzcsddecneigh aa (ind aa) hh2 a2
6

rpln $ zip [0.. ] $ sort $ map snd $ Map.toList $ zzcsddecneigh aa (ind aa) hh2 a2
"(0,3.5501620380141903)"
"(1,3.5501620380141903)"
"(2,3.5501620380141903)"
"(3,3.5501620380141903)"
"(4,16.16224874264553)"
"(5,16.16224874264553)"

let (a3,hh3) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) hh2 a2) !! 5

rpln $ aall $ ttaa $ fftt $ fmpi hh3

rpln $ aall $ (ttaa $ fftt $ fmpi hh3) `red`  (map VarInt [1,10])
"({(1,1),(10,1)},9 % 1)"
"({(1,2),(10,2)},9 % 1)"
"({(1,3),(10,2)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ fmpi hh3) `red`  (map VarInt [3,12])
"({(3,1),(12,1)},9 % 1)"
"({(3,2),(12,2)},9 % 1)"
"({(3,3),(12,2)},9 % 1)"

Now both variables 1 and 3 have been rolled. Only the non-pivot values 2 and 3 of variable 1 are rolled together.

The next neighbourhood cardinality of the remaining tri-valent variable, 11, of the regular reframe is $(n-2)d(d-1)/2$,

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

Map.size $ zzcsddecneigh aa (ind aa) hh3 a3
3

rpln $ zip [0.. ] $ sort $ map snd $ Map.toList $ zzcsddecneigh aa (ind aa) hh3 a3
"(0,4.04480505714146)"
"(1,4.04480505714146)"
"(2,19.61378180167165)"

let (a4,hh4) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) hh3 a3) !! 2

rpln $ aall $ ttaa $ fftt $ fmpi hh4

rpln $ aall $ (ttaa $ fftt $ fmpi hh4) `red`  (map VarInt [1,13])
"({(1,1),(13,1)},9 % 1)"
"({(1,2),(13,2)},9 % 1)"
"({(1,3),(13,2)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ fmpi hh4) `red`  (map VarInt [2,14])
"({(2,1),(14,1)},9 % 1)"
"({(2,2),(14,2)},9 % 1)"
"({(2,3),(14,2)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ fmpi hh4) `red`  (map VarInt [3,15])
"({(3,1),(15,1)},9 % 1)"
"({(3,2),(15,2)},9 % 1)"
"({(3,3),(15,2)},9 % 1)"

let (a4,hh4) = (sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) hh3 a3) !! 1

rpln $ aall $ ttaa $ fftt $ fmpi hh4

rpln $ aall $ (ttaa $ fftt $ fmpi hh4) `red`  (map VarInt [1,13])
"({(1,1),(13,1)},9 % 1)"
"({(1,2),(13,2)},9 % 1)"
"({(1,3),(13,2)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ fmpi hh4) `red`  (map VarInt [2,14])
"({(2,1),(14,1)},9 % 1)"
"({(2,2),(14,2)},9 % 1)"
"({(2,3),(14,1)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ fmpi hh4) `red`  (map VarInt [3,15])
"({(3,1),(15,1)},9 % 1)"
"({(3,2),(15,2)},9 % 1)"
"({(3,3),(15,2)},9 % 1)"

rpln $ zip [0.. ] $ sort $ map snd $ Map.toList $ zzcsddecneigh aa (ind aa) hh4 a4

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

let hh = llhh [pressure,cloud,wind,rain] [
      (1,[high,none,none,none]),
      (2,[medium,light,none,light]),
      (3,[high,none,light,none]),
      (4,[low,heavy,strong,heavy]),
      (5,[low,none,light,light]),
      (6,[medium,none,light,light]),
      (7,[low,heavy,light,heavy]),
      (8,[high,none,light,none]),
      (9,[medium,light,strong,heavy]),
      (10,[medium,light,light,light]),
      (11,[high,light,light,heavy]),
      (12,[medium,none,none,none]),
      (13,[medium,light,none,none]),
      (14,[high,light,strong,light]),
      (15,[medium,none,light,light]),
      (16,[low,heavy,strong,heavy]),
      (17,[low,heavy,light,heavy]),
      (18,[high,none,none,none]),
      (19,[low,light,none,light]),
      (20,[high,none,none,none])]

let aa = hhaa hh

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,fmpi a)) $ Map.toList $ zzcsddecinit aa (ind aa) 4

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,fder (fmpi a))) $ Map.toList $ zzcsddecinit aa (ind aa) 4
"(0,(0.5837680191252497,{1,2}))"
"(1,(0.7709893150145191,{1,2}))"
"(2,(0.8139736851717501,{1,2}))"
"(3,(0.9390100351220398,{1,2}))"
"(4,(0.943379728848379,{1,2}))"
"(5,(1.0076354978077768,{1,2}))"
"(6,(1.0277553712872054,{1,2}))"
"(7,(2.211185476441682,{1,2,3}))"
"(8,(2.353451053215166,{1,2,3}))"
"(9,(2.3632166043048763,{1,2,3}))"
"(10,(2.4263166197909776,{1,2,3}))"
"(11,(2.5392868497290313,{1,2,3}))"
"(12,(2.686485040395304,{1,2,3}))"
"(13,(3.9502840911392316,{1,2,3,4}))"


let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecinit aa (ind aa) 4

rpln $ aall $ ttaa $ fftt $ fmpi hh

algn aa
11.850852273417695

algn $ aa `fapply` fmpi hh
11.850852273417695

algnden $ aa `fapply` fmpi hh
3.9502840911392316

ent (aa `fapply` fmpi hh)
2.5536815580297962

cent (fftt ( fmpi hh)) aa
0.0

rent (aa `fapply` fmpi hh) (vvc `fapply` fmpi hh)
27.897985353328124

The cardinality of the neighbourhood of this regular reframe is $|N_{P,A,A_R,F,\mathrm{n},-,K}(C)| = nd(d-1)/2$,

4 * 3 * (3-1) `div` 2
12

Map.size $ zzcsddecneigh aa (ind aa) hh a
12

rpln $ zip [0.. ] $ sort $ map snd $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh) a
"(0,3.5899861448575137)"
"(1,3.5899861448575137)"
"(2,3.5899861448575137)"
"(3,3.731719163812727)"
"(4,3.7359345897870986)"
"(5,3.852385235284243)"
"(6,3.8523852352842445)"
"(7,3.9816367562403476)"
"(8,3.9916324088421202)"
"(9,4.250955413920492)"
"(10,4.392688434417141)"
"(11,4.425775067296826)"

let (a2,hh2) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh) a

a2
4.425775067296826

rpln $ aall $ ttaa $ fftt $ fmpi hh2

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

The first step rolls no winds and light winds together.

The alignment and entropy properties differ from the reframe,

algn $ aa `fapply` fmpi hh2
11.997417655007721

algnden $ aa `fapply` fmpi hh2
4.425775067296826

ent (aa `fapply` fmpi hh2)
2.316113923221488

cent (fftt ( fmpi hh2)) aa
0.23756763480830867

rent (aa `fapply` fmpi hh2) (vvc `fapply` fmpi hh2)
23.526648163057416

The cardinality of the neighbourhood in the second step is lower,

Map.size $ zzcsddecneigh aa (ind aa) hh2 a2
9

rpln $ zip [0.. ] $ sort $ map snd $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh2) a2
"(0,3.6387549882365358)"
"(1,3.6387549882365358)"
"(2,3.6387549882365358)"
"(3,3.848684625998968)"
"(4,4.028910969150104)"
"(5,4.208039118996101)"
"(6,4.373569551108929)"
"(7,4.525854369028599)"
"(8,4.535768164237375)"

let (a3,hh3) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh2) a2

a3
4.535768164237375

rpln $ aall $ ttaa $ fftt $ fmpi hh3

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

This step rolls low and medium pressure together.

The alignment and entropy properties differ again,

algn $ aa `fapply` fmpi hh3
11.110317593941934

algnden $ aa `fapply` fmpi hh3
4.535768164237375

ent (aa `fapply` fmpi hh3)
2.125159672733044

cent (fftt ( fmpi hh3)) aa
0.4285218852967525

rent (aa `fapply` fmpi hh3) (vvc `fapply` fmpi hh3)
19.712467277237124

The cardinality of the neighbourhood in the third step is lower still,

Map.size $ zzcsddecneigh aa (ind aa) hh3 a3
6

let (a4,hh4) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh3) a3

a4
4.377778525184473

rpln $ aall $ ttaa $ fftt $ fmpi hh4

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

The third step rolls no cloud and light cloud together. Note that the alignment valency-density, 4.377778525184473, has decreased from the second neighbourhood step.

The alignment and entropy properties differ again,

algn $ aa `fapply` fmpi hh4
9.689616684547989

algnden $ aa `fapply` fmpi hh4
4.377778525184473

ent (aa `fapply` fmpi hh4)
1.8479008005090656

cent (fftt ( fmpi hh4)) aa
0.7057807575207306

rent (aa `fapply` fmpi hh4) (vvc `fapply` fmpi hh4)
16.009512838580434

The cardinality of the neighbourhood in the last step is lower still,

Map.size $ zzcsddecneigh aa (ind aa) hh4 a4
3

let (a5,hh5) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh4) a4

a5
3.793559334517103

rpln $ aall $ ttaa $ fftt $ fmpi hh5

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

The final neighbourhood rolls no rain and light rain together. All of the rolled values are next to each other if the variable values are ordered naturally.

The alignment and entropy properties differ again,

algn $ aa `fapply` fmpi hh5
7.587118669034206

algnden $ aa `fapply` fmpi hh5
3.793559334517103

ent (aa `fapply` fmpi hh5)
1.6229667426615424

cent (fftt (fmpi hh5)) aa
0.9307148153682541

rent (aa `fapply` fmpi hh5) (vvc `fapply` fmpi hh5)
12.226475325872002

The alignments increase and then decrease through the sequence,

[algn (aa `fapply` fmpi ff) | ff <- [hh,hh2,hh3,hh4,hh5]]
[11.850852273417695,11.997417655007721,11.110317593941934,9.689616684547989,7.587118669034206]

The alignment valency-densities increase and then decrease through the sequence,

[algnden (aa `fapply` fmpi ff) | ff <- [hh,hh2,hh3,hh4,hh5]]
[3.9502840911392316,4.425775067296826,4.535768164237375,4.377778525184473,3.793559334517103]

The entropies decrease through the sequence,

[ent (aa `fapply` fmpi ff) | ff <- [hh,hh2,hh3,hh4,hh5]]
[2.5536815580297962,2.316113923221488,2.125159672733044,1.8479008005090656,1.6229667426615424]

The component entropies increase through the sequence,

[cent (fftt (fmpi ff)) aa | ff <- [hh,hh2,hh3,hh4,hh5]]
[0.0,0.23756763480830867,0.4285218852967525,0.7057807575207306,0.9307148153682541]

The relative entropies decrease through the sequence,

[rent (aa `fapply` fmpi ff) (vvc `fapply` fmpi ff) | ff <- [hh,hh2,hh3,hh4,hh5]]
[27.897985353328124,23.526648163057416,19.712467277237124,16.009512838580434,12.226475325872002]

Now consider the case were mmax constrains the initial tuple partition to have no more than three components,

rpln $ zip [0.. ] $ sort $ map (\(a,b) -> (b,fder (fmpi a))) $ Map.toList $ zzcsddecinit aa (ind aa) 3
"(0,(0.5837680191252497,{1,2}))"
"(1,(0.7709893150145191,{1,2}))"
"(2,(0.8139736851717501,{1,2}))"
"(3,(0.9390100351220398,{1,2}))"
"(4,(0.943379728848379,{1,2}))"
"(5,(1.0076354978077768,{1,2}))"
"(6,(1.0277553712872054,{1,2}))"
"(7,(2.211185476441682,{1,2,3}))"
"(8,(2.353451053215166,{1,2,3}))"
"(9,(2.3632166043048763,{1,2,3}))"
"(10,(2.4263166197909776,{1,2,3}))"
"(11,(2.5392868497290313,{1,2,3}))"
"(12,(2.686485040395304,{1,2,3}))"

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecinit aa (ind aa) 3

rpln $ aall $ ttaa $ fftt $ fmpi hh

rpln $ aall $ (ttaa $ fftt $ fmpi hh) `red` [pressure, wind, VarInt 2]
"({(pressure,high),(wind,light),(2,1)},9 % 1)"
"({(pressure,high),(wind,none),(2,2)},9 % 1)"
"({(pressure,high),(wind,strong),(2,3)},9 % 1)"
"({(pressure,low),(wind,light),(2,4)},9 % 1)"
"({(pressure,low),(wind,none),(2,5)},9 % 1)"
"({(pressure,low),(wind,strong),(2,6)},9 % 1)"
"({(pressure,medium),(wind,light),(2,7)},9 % 1)"
"({(pressure,medium),(wind,none),(2,8)},9 % 1)"
"({(pressure,medium),(wind,strong),(2,9)},9 % 1)"

The variables pressure and wind are grouped together because they are least aligned,

algn $ aa `red` [pressure,wind]
0.646716955827781

rpln $ sort [(algn (aa `red` [u,v]), u, v) | u <- Set.toList (vars aa), v <- Set.toList (vars aa), u < v]
"(0.646716955827781,pressure,wind)"
"(2.7673349953974995,cloud,wind)"
"(3.9301313052733455,rain,wind)"
"(4.27876667992199,pressure,rain)"
"(4.623278490123701,cloud,pressure)"
"(6.415037968300277,cloud,rain)"

The cardinality of the first neighbourhood is

9 * (9-1) `div` 2 + 2 * 3 * (3-1) `div` 2
42

Map.size $ zzcsddecneigh aa (ind aa) hh a
42

rpln $ zip [0.. ] $ sort $ map snd $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh) a
"(0,2.492372059622238)"
"(1,2.492372059622238)"
"(2,2.5124203933172757)"
"(3,2.5124203933172757)"
...
"(37,2.8543248287823357)"
"(38,2.8543248287823357)"
"(39,2.9199514895058174)"
"(40,3.0255287433153235)"
"(41,3.0659041194564773)"

let (a2,hh2) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh) a

a2
3.0659041194564782

rpln $ aall $ ttaa $ fftt $ fmpi hh2

rpln $ aall $ (ttaa $ fftt $ fmpi hh2) `red` [pressure, wind, VarInt 5]
"({(pressure,high),(wind,light),(5,1)},9 % 1)"
"({(pressure,high),(wind,none),(5,1)},9 % 1)"
"({(pressure,high),(wind,strong),(5,2)},9 % 1)"
"({(pressure,low),(wind,light),(5,3)},9 % 1)"
"({(pressure,low),(wind,none),(5,4)},9 % 1)"
"({(pressure,low),(wind,strong),(5,5)},9 % 1)"
"({(pressure,medium),(wind,light),(5,6)},9 % 1)"
"({(pressure,medium),(wind,none),(5,7)},9 % 1)"
"({(pressure,medium),(wind,strong),(5,8)},9 % 1)"

In the first step no wind and light winds are rolled together when the pressure is high.

The cardinality of the second neighbourhood is

8 * (8-1) `div` 2 + 2 * 3 * (3-1) `div` 2
34

Map.size $ zzcsddecneigh aa (ind aa) (fmpi hh2) a2
34

let (a3,hh3) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh2) a2

a3
3.447458910983245

rpln $ aall $ ttaa $ fftt $ fmpi hh3

rpln $ aall $ (ttaa $ fftt $ fmpi hh3) `red` [pressure, wind, VarInt 8]
"({(pressure,high),(wind,light),(8,1)},9 % 1)"
"({(pressure,high),(wind,none),(8,1)},9 % 1)"
"({(pressure,high),(wind,strong),(8,2)},9 % 1)"
"({(pressure,low),(wind,light),(8,3)},9 % 1)"
"({(pressure,low),(wind,none),(8,4)},9 % 1)"
"({(pressure,low),(wind,strong),(8,3)},9 % 1)"
"({(pressure,medium),(wind,light),(8,5)},9 % 1)"
"({(pressure,medium),(wind,none),(8,6)},9 % 1)"
"({(pressure,medium),(wind,strong),(8,7)},9 % 1)"

Now strong and light winds are rolled together when the pressure is low.

The cardinality of the third neighbourhood is

7 * (7-1) `div` 2 + 2 * 3 * (3-1) `div` 2
27

Map.size $ zzcsddecneigh aa (ind aa) (fmpi hh3) a3
27

let (a4,hh4) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh3) a3

a4
3.7677964713887753

rpln $ aall $ ttaa $ fftt $ fmpi hh4

rpln $ aall $ (ttaa $ fftt $ fmpi hh4) `red` [pressure, wind, VarInt 11]
"({(pressure,high),(wind,light),(11,1)},9 % 1)"
"({(pressure,high),(wind,none),(11,1)},9 % 1)"
"({(pressure,high),(wind,strong),(11,2)},9 % 1)"
"({(pressure,low),(wind,light),(11,3)},9 % 1)"
"({(pressure,low),(wind,none),(11,2)},9 % 1)"
"({(pressure,low),(wind,strong),(11,3)},9 % 1)"
"({(pressure,medium),(wind,light),(11,4)},9 % 1)"
"({(pressure,medium),(wind,none),(11,5)},9 % 1)"
"({(pressure,medium),(wind,strong),(11,6)},9 % 1)"

Interestingly, strong winds and high pressure is rolled with no wind and low pressure.

The cardinality of the fourth neighbourhood is

6 * (6-1) `div` 2 + 2 * 3 * (3-1) `div` 2
21

Map.size $ zzcsddecneigh aa (ind aa) (fmpi hh4) a4
21

let (a5,hh5) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh4) a4

a5
4.079737831819049

rpln $ aall $ ttaa $ fftt $ fmpi hh5

rpln $ aall $ (ttaa $ fftt $ fmpi hh5) `red` [pressure, wind, VarInt 14]
"({(pressure,high),(wind,light),(14,1)},9 % 1)"
"({(pressure,high),(wind,none),(14,1)},9 % 1)"
"({(pressure,high),(wind,strong),(14,2)},9 % 1)"
"({(pressure,low),(wind,light),(14,3)},9 % 1)"
"({(pressure,low),(wind,none),(14,2)},9 % 1)"
"({(pressure,low),(wind,strong),(14,3)},9 % 1)"
"({(pressure,medium),(wind,light),(14,4)},9 % 1)"
"({(pressure,medium),(wind,none),(14,2)},9 % 1)"
"({(pressure,medium),(wind,strong),(14,5)},9 % 1)"

Now (i) strong winds and high pressure and (ii) no wind and low pressure are rolled together with (iii) no wind and medium pressure.

The cardinality of the fifth neighbourhood is

5 * (5-1) `div` 2 + 2 * 3 * (3-1) `div` 2
16

Map.size $ zzcsddecneigh aa (ind aa) (fmpi hh5) a5
16

let (a6,hh6) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh5) a5

a6
4.3773876173959145

rpln $ aall $ ttaa $ fftt $ fmpi hh6

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

Now (i) no wind and light winds and high pressure are rolled together with (ii) strong winds and medium pressure. This seems surprising, but it leaves light winds and medium pressure as a separate value. Re-arranging shows the components,

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

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

"({(pressure,low),(wind,light),(17,3)},9 % 1)"
"({(pressure,low),(wind,strong),(17,3)},9 % 1)"

"({(pressure,medium),(wind,light),(17,4)},9 % 1)"

The cardinality of the sixth neighbourhood is

4 * (4-1) `div` 2 + 2 * 3 * (3-1) `div` 2
12

Map.size $ zzcsddecneigh aa (ind aa) (fmpi hh6) a6
12

let (a7,hh7) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh6) a6

a7
4.693548142467127

rpln $ aall $ ttaa $ fftt $ fmpi hh7

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

Re-arranging shows the components,

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

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

"({(pressure,low),(wind,light),(20,3)},9 % 1)"
"({(pressure,low),(wind,strong),(20,3)},9 % 1)"

The cardinality of the seventh neighbourhood is

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

Map.size $ zzcsddecneigh aa (ind aa) (fmpi hh7) a7
9

let (a8,hh8) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh7) a7

a8
4.702655089720556

rpln $ aall $ ttaa $ fftt $ fmpi hh8

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

Now no rain and light rain are rolled together.

The cardinality of the eighth neighbourhood is

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

Map.size $ zzcsddecneigh aa (ind aa) (fmpi hh8) a8
6

let (a9,hh9) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh8) a8

a9
4.546451517514757

rpln $ aall $ ttaa $ fftt $ fmpi hh9

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

Re-arranging shows the components,

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

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

but note that the alignment valency-density, 4.546451517514757, has decreased.

The cardinality of the final neighbourhood is

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

Map.size $ zzcsddecneigh aa (ind aa) (fmpi hh9) a9
3

let (a10,hh10) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecneigh aa (ind aa) (fmpi hh9) a9

a10
5.08585653022679

rpln $ aall $ ttaa $ fftt $ fmpi hh10

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

Lastly no and light cloud are rolled together.

The alignments increase and then decrease through the sequence,

[algn (aa `fapply` fmpi ff) | ff <- [hh,hh2,hh3,hh4,hh5,hh6,hh7,hh8,hh9,hh10]]
[11.62374568544222,12.754675123819222,13.717636228674525,14.241378258067032,14.51119217807198,14.453815452853494,14.080644427401381,12.324442856317813,10.408775610354702,10.17171306045358]

The alignment valency-densities increase, then decrease, but ends with the maximum,

[algnden (aa `fapply` fmpi ff) | ff <- [hh,hh2,hh3,hh4,hh5,hh6,hh7,hh8,hh9,hh10]]
[2.686485040395303,3.0659041194564782,3.447458910983245,3.7677964713887757,4.079737831819049,4.3773876173959145,4.693548142467127,4.702655089720556,4.546451517514757,5.08585653022679]

The entropies decrease through the sequence,

[ent (aa `fapply` fmpi ff) | ff <- [hh,hh2,hh3,hh4,hh5,hh6,hh7,hh8,hh9,hh10]]
[2.5536815580297962,2.3854286412774823,2.2467992051654933,2.1774844871094987,2.082007361865277,2.0126926438092823,1.9002256148855206,1.6796478837567517,1.4150225884935588,0.9819416009240194]

The component entropies increase through the sequence,

[cent (fftt (fmpi ff)) aa | ff <- [hh,hh2,hh3,hh4,hh5,hh6,hh7,hh8,hh9,hh10]]
[0.0,0.16825291675231413,0.3068823528643032,0.3761970709202977,0.4716741961645196,0.5409889142205141,0.6534559431442758,0.8740336742730448,1.1386589695362375,1.571739957105777]

The relative entropies decrease through the sequence,

[rent (aa `fapply` fmpi ff) (vvc `fapply` fmpi ff) | ff <- [hh,hh2,hh3,hh4,hh5,hh6,hh7,hh8,hh9,hh10]]
[27.897985353328238,27.345733172826385,26.82248502906168,26.822485029061795,25.096392594351016,23.922552340142033,21.507666756826097,17.889789562940678,13.802744829232239,11.664861945989742]

Now that all of the derived variables are bi-valent, the alignment valency-density, 5.08585653022679, has, in fact, increased to its highest value. This alignment valency-density is higher than the case for the self-partition of the tuple, $Y = K^{\{\}}$, where let mmax = 4. In that case the highest value was 4.535768164237375. That is, constraining the cardinality of the tuple partition, $|Y|$, can lead to higher optimisation in some cases.

The weather forecast example continues in Contracted decrementing linear non-overlapping fuds list maximiser.

Now we continue with the discussion of the optimiser. See section ‘Optimisation’ P690. The subset of the decrementing linear non-overlapping fuds is \[ \mathrm{dom}(\mathrm{elements}(Z_{P,A,A_R,F,\mathrm{n},-,K})) \subset \mathcal{F}_{U_A,\mathrm{n},-,K,\overline{\mathrm{b}},\mathrm{mmax},\overline{2}} \] The choice of tuple fuds, $Q \subset \mathcal{F}_{U_A,\mathrm{n},-,K,\overline{\mathrm{b}},\mathrm{mmax},\overline{2}}$, can be made by maximising the shuffle content alignment valency-density of the elements of the tree maximiser, $Z_{P,A,A_R,F,\mathrm{n},-,K}$, (Text) \[ \begin{eqnarray} Q = \mathrm{topd}(\mathrm{pmax})(\mathrm{elements}(Z_{P,A,A_R,F,\mathrm{n},-,K})) \end{eqnarray} \] The optimiser function is defined in module AlignmentPracticable,

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

as

parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementing mmax pmax uu aa aarr ff kk
  ...
  | ... = Just $ opt (zzcsddecneigh uu aa aarr ff) (top pmax) (zzcsddecinit mmax uu aa aarr ff kk)
  | otherwise = Nothing
  where
    opt pp ii rr = let qq = ii rr in (qq, rr) : ls qq
      where
        ls yy = if isempty yy then [] else let nn = pp yy; qq = ii nn in (qq, nn) : ls qq
    zzcsddecinit mmax uu aa aarr ff kk =  
      parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementing_u mmax uu aa aarr ff kk
    zzcsddecneigh uu aa aarr ff mm = 
      parametersSystemsSamplesShufflesFudsFunctionsFunctionNeighbourhoodFudDecrementing_u uu aa aarr ff mm
    ...

For example,

let zzcsddecopt aa rr mmax pmax = fromJust $ parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementing mmax pmax (sys aa) aa rr fudEmpty (vars aa)

let aa = resize 90 $ regpivot 3 2 `mul` regtranspose [3] (regcart 3 1)

rpln $ zip [0.. ] $ map (sort . Map.elems) $ snd $ unzip $ zzcsddecopt aa (ind aa) 3 1
"(0,[0.0,6.137371702752476,6.137371702752478,10.6302396141028])"
"(1,[2.8026431226723085,2.8026431226723085,...,13.350624478517439,13.350624478517457])"
"(2,[3.5501620380141903,3.5501620380141903,...,16.16224874264553,16.16224874264553])"
"(3,[4.04480505714146,4.04480505714146,19.61378180167165])"
"(4,[])"

rpln $ zip [0.. ] $ map (sort . Map.elems) $ snd $ unzip $ zzcsddecopt aa (ind aa) 3 2
"(0,[0.0,6.137371702752476,6.137371702752478,10.6302396141028])"
"(1,[1.7312337731266625,1.7312337731266625,...,13.350624478517439,13.350624478517457])"
"(2,[3.550162038014178,3.550162038014178,...,16.16224874264553,16.16224874264553])"
"(3,[4.04480505714146,4.04480505714146,...,19.61378180167165,19.61378180167165])"
"(4,[])"

An implementation that uses partition variables sometimes becomes impracticable as the parameters are varied. We can see this also in the discussion of the neighbourhood function, above, where the partition variables are replaced by cardinal variables using fpmi. So consider the optimiser function with an additional argument of a list of variables, [Variable], defined in module AlignmentPracticable,

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

as

parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionOptimiserFudDecrementing 
  mmax pmax uu aa aarr ff kk ll
  ...
  | ... = Just $ if gg == [] then ([],(uu,ll)) else (jj,last gg)
  | otherwise = Nothing
  where
    (jj,gg) = unzip $ opt (zzcsddecneigh aa aarr ff) (top pmax) (zzcsddecinit mmax uu aa aarr ff kk ll)
    opt pp ii (rr,(uu',ll')) = let mm = ii rr in ((mm,rr),(uu',ll')) : ls mm uu' ll'
      where
        ls mm uu ll = 
          if isempty mm 
          then [] 
          else let (nn,(uu',ll')) = pp mm uu ll; mm' = ii nn in ((mm',nn),(uu',ll')) : ls mm' uu' ll'
    zzcsddecinit =  
      parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionInitialFudDecrementing_u
    zzcsddecneigh aa aarr ff mm uu ll = 
      systemsSamplesShufflesFudsFunctionsListVariablesFunctionNeighbourhoodFudDecrementing_u uu aa aarr ff mm ll
    ...

The added complexity is because of the need to thread the sequence of variables and systems through the recursion. The calculation is faster now,

let zzcsddecopt aa rr mmax pmax = fromJust $ parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementing mmax pmax (sys aa) aa rr fudEmpty (vars aa)

let zzllcsddecopt aa rr mmax pmax = fst $ fromJust $ parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionOptimiserFudDecrementing mmax pmax (sys aa) aa rr fudEmpty (vars aa)  [VarInt i | i <-[10..]]


let aa = resize 90 $ regpivot 3 2 `mul` regtranspose [3] (regcart 3 1)

:set +s

rpln $ zip [0.. ] $ map (sort . Map.elems) $ snd $ unzip $ zzcsddecopt aa (ind aa) 3 1
"(0,[0.0,6.137371702752476,6.137371702752478,10.6302396141028])"
"(1,[2.8026431226723085,2.8026431226723085,...,13.350624478517439,13.350624478517457])"
"(2,[3.5501620380141903,3.5501620380141903,...,16.16224874264553,16.16224874264553])"
"(3,[4.04480505714146,4.04480505714146,19.61378180167165])"
(4.25 secs, 2279167352 bytes)

rpln $ zip [0.. ] $ map (sort . Map.elems) $ snd $ unzip $ zzllcsddecopt aa (ind aa) 3 1
"(0,[0.0,6.137371702752476,6.137371702752478,10.6302396141028])"
"(1,[2.8026431226723085,2.8026431226723085,...,13.350624478517439,13.350624478517457])"
"(2,[3.5501620380141903,3.5501620380141903,...,16.16224874264553,16.16224874264553])"
"(3,[4.04480505714146,4.04480505714146,19.61378180167165])"
(0.34 secs, 104662304 bytes)

rpln $ zip [0.. ] $ map (sort . Map.elems) $ snd $ unzip $ zzcsddecopt aa (ind aa) 3 2
"(0,[0.0,6.137371702752476,6.137371702752478,10.6302396141028])"
"(1,[1.7312337731266625,1.7312337731266625,...,13.350624478517439,13.350624478517457])"
"(2,[3.550162038014178,3.550162038014178,...,16.16224874264553,16.16224874264553])"
"(3,[4.04480505714146,4.04480505714146,...,19.61378180167165,19.61378180167165])"
"(4,[])"
(16.92 secs, 8782441152 bytes)

rpln $ zip [0.. ] $ map (sort . Map.elems) $ snd $ unzip $ zzllcsddecopt aa (ind aa) 3 2
"(0,[0.0,6.137371702752476,6.137371702752478,10.6302396141028])"
"(1,[1.7312337731266625,1.7312337731266625,...,13.350624478517439,13.350624478517457])"
"(2,[3.550162038014178,3.550162038014178,...,16.16224874264553,16.16224874264553])"
"(3,[4.04480505714146,4.04480505714146,...,19.61378180167165,19.61378180167165])"
"(4,[])"
(1.01 secs, 318501576 bytes)

:unset +s

Now let us examine the optimal model,

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ concat $ map Map.toList $ snd $ unzip $ zzllcsddecopt aa (ind aa) 3 1

a
19.61378180167165

rpln $ aall $ ttaa $ fftt $ hh

rpln $ aall $ (ttaa $ fftt $ hh) `red` [VarInt 1, VarInt 64]
"({(1,1),(64,1)},9 % 1)"
"({(1,2),(64,2)},9 % 1)"
"({(1,3),(64,2)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ hh) `red` [VarInt 2, VarInt 65]
"({(2,1),(65,1)},9 % 1)"
"({(2,2),(65,2)},9 % 1)"
"({(2,3),(65,2)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ hh) `red` [VarInt 3, VarInt 66]
"({(3,1),(66,1)},9 % 1)"
"({(3,2),(66,2)},9 % 1)"
"({(3,3),(66,2)},9 % 1)"

All of the underlying tri-valent variables are rolled down to bi-valent. The pivot variables, 1 and 2, are rolled in the non-pivot values, 2 and 3.

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

let hh = llhh [pressure,cloud,wind,rain] [
      (1,[high,none,none,none]),
      (2,[medium,light,none,light]),
      (3,[high,none,light,none]),
      (4,[low,heavy,strong,heavy]),
      (5,[low,none,light,light]),
      (6,[medium,none,light,light]),
      (7,[low,heavy,light,heavy]),
      (8,[high,none,light,none]),
      (9,[medium,light,strong,heavy]),
      (10,[medium,light,light,light]),
      (11,[high,light,light,heavy]),
      (12,[medium,none,none,none]),
      (13,[medium,light,none,none]),
      (14,[high,light,strong,light]),
      (15,[medium,none,light,light]),
      (16,[low,heavy,strong,heavy]),
      (17,[low,heavy,light,heavy]),
      (18,[high,none,none,none]),
      (19,[low,light,none,light]),
      (20,[high,none,none,none])]

let aa = hhaa hh

rpln $ zip [0.. ] $ map (sort . Map.elems) $ snd $ unzip $ zzllcsddecopt aa (ind aa) 4 1

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ concat $ map Map.toList $ snd $ unzip $ zzllcsddecopt aa (ind aa) 4 1

a
4.535768164237377


rpln $ aall $ ttaa $ fftt $ hh

rpln $ aall $ (ttaa $ fftt $ hh) `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 $ hh) `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 $ hh) `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 $ hh) `red` [rain, VarInt 109]
"({(rain,heavy),(109,1)},27 % 1)"
"({(rain,light),(109,2)},27 % 1)"
"({(rain,none),(109,3)},27 % 1)"

algn $ aa `fapply` hh
11.110317593941938

algnden $ aa `fapply` hh
4.535768164237377

ent (aa `fapply` hh)
2.1251596727330435

cent (fftt hh) aa
0.4285218852967525

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

When the tuple partition is just the self-partition, $K^{\{\}}$, the optimal alignment valency-density is obtained when only pressure and wind are rolled down from tri-valent to bi-valent. Variables cloud and rain are merely reframed to tri-valent derived variables.

Now impose the constraint let mmax = 3,

length $ map (sort . Map.elems) $ snd $ unzip $ zzllcsddecopt aa (ind aa) 3 1
11

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ concat $ map Map.toList $ snd $ unzip $ zzllcsddecopt aa (ind aa) 3 1

a
5.08585653022679

rpln $ aall $ ttaa $ fftt $ hh

rpln $ aall $ (ttaa $ fftt $ hh) `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 $ hh) `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 $ hh) `red` [rain, VarInt 545]
"({(rain,heavy),(545,1)},27 % 1)"
"({(rain,light),(545,2)},27 % 1)"
"({(rain,none),(545,2)},27 % 1)"

algn $ aa `fapply` hh
10.17171306045358

algnden $ aa `fapply` hh
5.08585653022679

ent (aa `fapply` hh)
0.9819416009240194

cent (fftt hh) aa
1.571739957105777

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

This is the case described above in the neighbourhood discussion. The alignment valency-density is higher than in the case of the self-partition of the tuple. Pressure and wind are the underlying variables of a bi-valent derived variable, 544, which rolls windy low pressure states together. The tri-valent cloud and rain variables are both rolled to bi-valent derived variables.

Now consider the constraint let mmax = 2,

length $ map (sort . Map.elems) $ snd $ unzip $ zzllcsddecopt aa (ind aa) 2 1
16

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ concat $ map Map.toList $ snd $ unzip $ zzllcsddecopt aa (ind aa) 2 1

a
4.085635626063555


rpln $ aall $ ttaa $ fftt $ hh

rpln $ aall $ (ttaa $ fftt $ hh) `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 $ hh) `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)"

algn $ aa `fapply` hh
8.17127125212711

algnden $ aa `fapply` hh
4.085635626063555

ent (aa `fapply` hh)
0.8237197315118312

cent (fftt hh) aa
1.7299618265179653

rent (aa `fapply` hh) (vvc `fapply` hh)
10.061363379300005

The alignment valency-density is lower than for either the self-partition or the tri-component partition of the tuple. Pressure and wind are the underlying variables of a bi-valent derived variable. Cloud and rain variables are also the underlying variables of a bi-valent derived variable.

Now consider if the optimisation is predictive of rain. First examine the initial fud,

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ Map.toList $ zzcsddecinit (aa `red` [cloud,pressure,wind]) (ind (aa `red` [cloud,pressure,wind])) 3

a
2.15004722009382

Again, the initial fud is just the reframe,


rpln $ aall $ ttaa $ fftt $ fmpi hh

algn $ aa `red` [cloud,pressure,wind]
6.450141660281459

algn $ aa `fapply` fmpi hh
6.450141660281459

algnden $ aa `fapply` fmpi hh
2.15004722009382

ent (aa `fapply` fmpi hh)
2.4843668399738017

cent (fftt (fmpi hh)) (aa `red` [cloud,pressure,wind])
0.0

rent (aa `fapply` fmpi hh) (vvc `fapply` fmpi hh)
13.532586393502129

tlalgn (fftt (fmpi hh)) aa [rain]
11.850852273417697

tlent (fftt (fmpi hh)) aa [rain]
1.3862943611198906

size $ eff (aa `fapply` fmpi hh) `mul` (vvc `fapply` fmpi hh)
39 % 1

Now consider the whole optimisation,

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ concat $ map Map.toList $ snd $ unzip $ zzllcsddecopt (aa `red` [cloud,pressure,wind]) (ind (aa `red` [cloud,pressure,wind])) 3 1

a
2.7511891512744207


rpln $ aall $ ttaa $ fftt $ hh

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

rpln $ aall $ (ttaa $ fftt $ hh) `red` [wind, VarInt 65]
"({(wind,light),(65,1)},9 % 1)"
"({(wind,none),(65,1)},9 % 1)"
"({(wind,strong),(65,2)},9 % 1)"

rpln $ aall $ (ttaa $ fftt $ hh) `red` [pressure, VarInt 66]
"({(pressure,high),(66,1)},9 % 1)"
"({(pressure,low),(66,2)},9 % 1)"
"({(pressure,medium),(66,1)},9 % 1)"

rpln $ aall $ aa `fapply` hh
"({(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)"

algn $ aa `fapply` hh
5.502378302548841

algnden $ aa `fapply` hh
2.7511891512744207

ent (aa `fapply` hh)
1.2275294114572126

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

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

tlalgn (fftt hh) aa [rain]
9.542774419869675

tlent (fftt hh) aa [rain]
12.038625670709138

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

The rolled model is less predictive than the reframe, but is more effective, having $\mathrm{size}((A * T)^{\mathrm{F}} * (V^{\mathrm{C}} * T)) = 57$ states that are underlying effective derived states.

Now consider the optimisation when the tuple partition is constrained to have just two components, let mmax = 2,

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ concat $ map Map.toList $ snd $ unzip $ zzllcsddecopt (aa `red` [cloud,pressure,wind]) (ind (aa `red` [cloud,pressure,wind])) 2 1

a
3.0601487103147385

rpln $ aall $ ttaa $ fftt $ hh

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

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

Re-arranging,

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

"({(pressure,low),(wind,light),(297,2)},3 % 1)"
"({(pressure,low),(wind,strong),(297,2)},3 % 1)"

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

algn $ aa `fapply` hh
6.120297420629477

algnden $ aa `fapply` hh
3.0601487103147385

ent (aa `fapply` hh)
0.6874357505033553

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

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

tlalgn (fftt hh) aa [rain]
9.21757669489453

tlent (fftt hh) aa [rain]
14.862530796657737

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

This rolled model is the least predictive, but is most effective, having $\mathrm{size}((A * T)^{\mathrm{F}} * (V^{\mathrm{C}} * T)) = 60$ states that are underlying effective derived states.

The weather forecast example continues in Maximum-roll-by-derived-dimension contracted decrementing linear non-overlapping fuds tree maximiser.

For a given tuple partition $Y \in \mathrm{B}(K)$ the cardinality of the neighbourhood searched could be computed by constructing a tree of lists of valencies, $\mathrm{trees}(\mathcal{L}(\mathbf{N}_{>0}))$, congruent to the pluri-valent self non-overlapping substrate decremented partition-sets cardinality tree, $\mathrm{tdecpcd}(Y) \in \mathrm{trees}(\mathbf{N} \times \mathcal{L}(\mathbf{N}))$. See ‘Optimisation’ P689. However, the computation of the tree is exponential and so is impracticable as a measure of expected computation time.

Instead of finding the cardinalities of searched for all possible search paths, consider the cardinality of the searched in the worst case which is found by decrementing the head of a sorted list of component volumes. Rolling the shortest first is the worst case because the cardinality of the decrements, $c(c-1)/2$, is convex. Let $\mathrm{srch} \in \mathcal{L}(\mathbf{N}) \to \mathbf{N}$ be defined $\mathrm{srch}(L) := \sum (c(c-1)/2 : (\cdot,c) \in L,~c>2)$. Let $\mathrm{dec} \in \mathcal{K}(\mathbf{N}) \to \mathcal{K}(\mathbf{N})$ be defined $\mathrm{dec}((x,K)) := \mathrm{if}(x>2,(x-1,K),\mathrm{dec}(K))$. Let $\mathrm{srchmax} \in \mathbf{N} \times \mathcal{L}(\mathbf{N}) \to \mathbf{N}$ be defined $\mathrm{srchmax}(m,\emptyset) := m$ and $\mathrm{srchmax}(m,L) := \mathrm{srchmax}(m+\mathrm{srch}(L),\mathrm{dec}(L))$. Let $\mathrm{srchmax} \in \mathrm{P}(\mathrm{P}(\mathcal{V}_U)) \to \mathbf{N}$ be defined $\mathrm{srchmax}(Y) := \mathrm{srchmax}(0,\mathrm{sort}(\{(i,|J^{\mathrm{C}}|) : (J,i) \in \mathrm{order}(D_{\mathrm{P}(\mathrm{P}(\mathcal{V}))},Y)\}))$, where $\mathrm{sort}(L) := \{(i,a) : ((a,\cdot),i) \in \mathrm{order}(D_{\mathrm{N}^2},\mathrm{flip}(L))\}$. Then $\mathrm{srchmax}(Y) \in \mathbf{N}$ is the greatest cardinality of the searched for the given partition, $Y$.

The maximum cardinality of the worst-case searched is \[ \mathrm{maxr}(\{(Y,\mathrm{srchmax}(Y)) : m \in \{2 \ldots \mathrm{mmax}\},~Y \in \mathrm{S}(K,m)\}) \in \mathbf{N}_{>0} \] In the case of a regular tuple of dimension $k=|K|$ and valency $d$, the maximum cardinality of the worst-case searched is \[ \mathrm{maxr}(\{(L, a \times \mathrm{srchmax}(L)) : m \in \{2 \ldots \mathrm{mmax}\},~(L,a) \in \mathrm{sscd}(k,m)\}) \in \mathbf{N}_{>0} \] where $\mathrm{srchmax}(L) := \mathrm{srchmax}(0,\mathrm{sort}(\mathrm{concat}(\{\{1 \ldots p\} \times \{d^j\} : (j,p) \in L\})))$.

A cardinality list function of $(\mathrm{srchmax}(Y) : m \in \{2 \ldots \mathrm{mmax}\},~Y \in \mathrm{S}(K,m))$ is defined in module AlignmentSubstrate,

systemsSetVarsLimitsSetSetPartitionCartesianSubstrateNonOverlapTreeDecSubsSelfPluriLimBrPluriValChoiceMaxListCard ::
  System -> Set.Set Variable -> Integer -> Maybe [Integer]  

as

systemsSetVarsLimitsSetSetPartitionCartesianSubstrateNonOverlapTreeDecSubsSelfPluriLimBrPluriValChoiceMaxListCard
  uu vv bmax
  ...
  | ... = Just $ 
    [mx 0 ll | yy <- stirsll vv bmax, dim yy >= 2, let ll = sort [v | jj <- qqll yy, let v = vol uu jj, v > 2]]
  | otherwise = Nothing
  where
    mx m [] = m
    mx m ll = mx (m + schd ll) (dec ll)
    dec [] = []
    dec (x:xx) = if x > 2 then ((x-1):xx) else (dec xx)
    schd = foldl (\n c -> if c > 2 then n + c * (c-1) `div` 2 else n) 0
    ...
    stirsll vv bmax = Set.toList $ setsSetPartitionLimited vv bmax
    ...

A cardinality list function for the regular case of $(a \times \mathrm{srchmax}(L) : m \in \{2 \ldots \mathrm{mmax}\},~(L,a) \in \mathrm{sscd}(k,m))$ is also defined in module AlignmentSubstrate,

valenciesDimensionsLimitsSetSetPartitionCartesianSubsNonOvTreeDecSubsSelfPluriLimBrPluriValChoiceMaxListCardReg :: 
  Integer -> Integer -> Integer -> Maybe [Integer] 

as

valenciesDimensionsLimitsSetSetPartitionCartesianSubsNonOvTreeDecSubsSelfPluriLimBrPluriValChoiceMaxListCardReg 
  d n bmax
  | ... = Just $ 
      concat [replicate (fromInteger a) (mx 0 mm) | (ll,a) <- sscdlimpvll n (min n bmax), 
            let mm = sort (concat [replicate (fromInteger p) (d^j) | (j,p) <- zip [1..] ll, d^j > 2])]
  | otherwise = Nothing
  where
    mx m [] = m
    mx m ll = mx (m + schd ll) (dec ll)
    dec [] = []
    dec (x:xx) = if x > 2 then ((x-1):xx) else (dec xx)
    schd = foldl (\n c -> if c > 2 then n + c * (c-1) `div` 2 else n) 0
    sscdlimpvll n k = Map.toList $ Map.filterWithKey (\kk _ -> sum kk > 1 && sum kk <= k) (bellcd n)

We can now compute the search worst cases which are always less than $\mathrm{xmax}^3/2^4$. For example,

let nnvvnctnsdbmaxpvchcds uu bmax = fromJust $ systemsSetVarsLimitsSetSetPartitionCartesianSubstrateNonOverlapTreeDecSubsSelfPluriLimBrPluriValChoiceMaxListCard uu (uvars uu) bmax

let nnvvnctnsdbmaxpvchcdsr d n bmax = fromJust $ valenciesDimensionsLimitsSetSetPartitionCartesianSubsNonOvTreeDecSubsSelfPluriLimBrPluriValChoiceMaxListCardReg d n bmax

let uu = sysreg 3 2

sort $ nnvvnctnsdbmaxpvchcds uu 2
[9]

sort $ nnvvnctnsdbmaxpvchcdsr 3 2 2
[9]

let uu = sysreg 3 3

sort $ nnvvnctnsdbmaxpvchcds uu 3
[18,158,158,158]

sort $ nnvvnctnsdbmaxpvchcdsr 3 3 3
[18,158,158,158]

sort $ nnvvnctnsdbmaxpvchcdsr 3 3 2
[158,158,158]

sort $ nnvvnctnsdbmaxpvchcdsr 3 4 4
[30,200,200,200,200,200,200,490,490,490,3629,3629,3629,3629]

sort $ nnvvnctnsdbmaxpvchcdsr 3 4 3
[200,200,200,200,200,200,490,490,490,3629,3629,3629,3629]

sort $ nnvvnctnsdbmaxpvchcdsr 3 4 2
[490,490,490,3629,3629,3629,3629]

length $ nnvvnctnsdbmaxpvchcdsr 3 5 5
51

maximum $ nnvvnctnsdbmaxpvchcdsr 3 5 5
91802

(3^5)^3 `div` (2^4)
896806

length $ nnvvnctnsdbmaxpvchcdsr 4 4 4
14

maximum $ nnvvnctnsdbmaxpvchcdsr 4 4 4
47720

(4^4)^3 `div` (2^4)
1048576

length $ nnvvnctnsdbmaxpvchcdsr 4 5 5
51

maximum $ nnvvnctnsdbmaxpvchcdsr 4 5 5
2861448

(4^5)^3 `div` (2^4)
67108864

maximum $ nnvvnctnsdbmaxpvchcdsr 4 5 3
2861448

Note that reducing mmax does not reduce the worst case computation time. These worst cases occur when the partition of the tuple is such that all components but one are singletons, $\exists C \in Y~\forall D \in Y~(D \neq C \implies |D| = 1)$. The worst case computation time is proportional to the square of the volume of the remainder component, $|C^{\mathrm{C}}|$. The addition of a limit to the valency, umax, of the components is discussed in the limited-valency contracted decrementing linear non-overlapping fuds list maximiser below.

A variation of the contracted decrementing linear non-overlapping fuds list maximiser is to restrict the neighbourhood optimisation to the maximum, $\mathrm{pmax}=1$, and apply $\mathrm{pmax}$ only to the initial set. To do this a tree tail maximiser is used with an inclusion function of $\mathrm{max}$ and the initial set is explicitly optimised beforehand. Define the maximum-roll contracted decrementing linear non-overlapping fuds tree maximiser (Text) \[ \begin{eqnarray} &&Z_{P,A,A_R,F,\mathrm{n},-,K,\mathrm{mr}} =\\ &&\hspace{2em}\mathrm{maximiseTailTreer}(X_{P,A,A_R,F,\mathrm{n},-,K},N_{P,A,A_R,F,\mathrm{n},-,K},\mathrm{max},\\ &&\hspace{15em}\mathrm{top}(\mathrm{pmax})(R_{P,A,A_R,F,\mathrm{n},-,K})) \end{eqnarray} \] This restriction pushes the $\mathrm{pmax}$ path selection into the initial set rather than towards the end of the optimise path where sometimes different decrementing linear fuds roll to the same derived partition variables.

The optimiser function is defined in module AlignmentPracticable,

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

as

parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementingMaximumRoll mmax pmax uu aa aarr ff kk
  ...
  | ... = Just $ 
      opt (zzcsddecneigh uu aa aarr ff) (top pmax) (zzcsddecinit mmax uu aa aarr ff kk)
  | otherwise = Nothing
  where
    opt pp ii rr = Tree $ llmm [((gg,a), ts (sgl gg a)) | (gg,a) <- mmll (ii rr)]
      where
        ts yy = Tree $ llmm [((gg,a), ts (sgl gg a)) | (gg,a) <- mmll (top 1 (pp yy))]
    zzcsddecinit mmax uu aa aarr ff kk =  
      parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementing_u mmax uu aa aarr ff kk
    zzcsddecneigh uu aa aarr ff mm = 
      parametersSystemsSamplesShufflesFudsFunctionsFunctionNeighbourhoodFudDecrementing_u uu aa aarr ff mm
    ...
	sgl = Map.singleton
    ...

Note that this optimiser is a tree maximiser rather than a list maximiser, so the recursion is different. There is only a single path for each initial root element, however, because only the maximum for each neighbourhood is taken.

For example,

let zzcsddecoptmr aa rr mmax pmax = fromJust $ parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementingMaximumRoll mmax pmax (sys aa) aa rr fudEmpty (vars aa)

let aa = resize 90 $ regpivot 3 2 `mul` regtranspose [3] (regcart 3 1)

rpln $ zip [0.. ] $ map (map snd) $ Set.toList $ treesPaths $ zzcsddecoptmr aa (ind aa) 3 1
"(0,[10.6302396141028,13.350624478517457,16.16224874264553,19.61378180167165])"

Consider a variation of the maximum-roll maximiser that has an initial set of cardinality $\mathrm{pmax}$ for each of the possible tuple partition cardinalities, $m \in \{2 \ldots \mathrm{mmax}\}$. Define the maximum-roll-by-derived-dimension contracted decrementing linear non-overlapping fuds tree maximiser (Text) \[ \begin{eqnarray} &&Z_{P,A,A_R,F,\mathrm{n},-,K,\mathrm{mm}} =\\ &&\hspace{2em}\mathrm{maximiseTailTreer}(X_{P,A,A_R,F,\mathrm{n},-,K},N_{P,A,A_R,F,\mathrm{n},-,K},\mathrm{max},R_{P,A,A_R,F,\mathrm{n},-,K,\mathrm{mm}}) \end{eqnarray} \] where the initial subset is \[ \begin{eqnarray} &&R_{P,A,A_R,F,\mathrm{n},-,K,\mathrm{mm}} = \\ &&\hspace{2em}\bigcup \{\mathrm{top}(\mathrm{pmax})(\{(\{M^{\mathrm{T}}\},X_{P,A,A_R,F,\mathrm{n},-,K}(\{M^{\mathrm{T}}\})) : \\ &&\hspace{10em}Y \in \mathrm{S}(K,m),~M = \{J^{\mathrm{CS}\{\}} : J \in Y\}\}) : m \in \{2 \ldots \mathrm{mmax}\}\} \end{eqnarray} \] Now the cardinality of the searched is constrained \[ |\mathrm{searched}(Z_{P,A,A_R,F,\mathrm{n},-,K,\mathrm{mm}})| \leq \mathrm{bell}(\mathrm{kmax}) + (\mathrm{mmax}-1) \times \mathrm{pmax} \times \mathrm{xmax}^3/2^4 \]

The initial function is defined in module AlignmentPracticable,

parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementingMaxRollByM_u :: 
  Integer -> Integer -> System -> Histogram -> Histogram -> Fud -> Set.Set Variable -> Map.Map Fud Double

as

parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementingMaxRollByM_u 
  mmax pmax uu aa aarr ff kk = llmm 
    (concat [top pmax [(ii, (algn (aa `fmul` gg) - algn (aarr `fmul` gg)) / (w' ** (1/m))) |
        zz <- stirsll kk b, dim zz >= 2,
        let nn = llqq [self uu jj | jj <- qqll zz],
        let ii = ttff (nntt nn),
        let gg = depends ff kk `funion` ii,
        let ww = fder gg, let w = vol (uu `uunion` fsys gg) ww,
        let w' = fromIntegral w, let m = fromIntegral (Set.size ww)] | b <- [2..mmax]])
    ...

The optimiser function is defined in module AlignmentPracticable,

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

as

parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementingMaxRollByM mmax pmax uu aa aarr ff kk
  ...
  | ... = Just $ 
      opt (zzcsddecneigh uu aa aarr ff) (zzcsddecinit mmax pmax uu aa aarr ff kk)
  | otherwise = Nothing
  where
    opt pp rr = Tree $ llmm [((gg,a), ts (sgl gg a)) | (gg,a) <- mmll rr]
      where
        ts yy = Tree $ llmm [((gg,a), ts (sgl gg a)) | (gg,a) <- mmll (top 1 (pp yy))]
    zzcsddecinit mmax pmax uu aa aarr ff kk =  
      parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementingMaxRollByM_u mmax pmax uu aa aarr ff kk
    zzcsddecneigh uu aa aarr ff mm = 
      parametersSystemsSamplesShufflesFudsFunctionsFunctionNeighbourhoodFudDecrementing_u uu aa aarr ff mm
    ...

For example,

let zzcsddecoptmm aa rr mmax pmax = fromJust $ parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementingMaxRollByM mmax pmax (sys aa) aa rr fudEmpty (vars aa)

let aa = resize 90 $ regpivot 3 2

rpln $ zip [0.. ] $ map (map snd) $ Set.toList $ treesPaths $ zzcsddecoptmm aa (ind aa) 3 1
"(0,[12.86465093182909,16.309940702291883,20.70854065875355])"

Just as for the contracted decrementing linear non-overlapping fuds list maximiser, above, there is an implementation of the optimiser function with an additional argument of a list of variables, [Variable], defined in module AlignmentPracticable,

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

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

let hh = llhh [pressure,cloud,wind,rain] [
      (1,[high,none,none,none]),
      (2,[medium,light,none,light]),
      (3,[high,none,light,none]),
      (4,[low,heavy,strong,heavy]),
      (5,[low,none,light,light]),
      (6,[medium,none,light,light]),
      (7,[low,heavy,light,heavy]),
      (8,[high,none,light,none]),
      (9,[medium,light,strong,heavy]),
      (10,[medium,light,light,light]),
      (11,[high,light,light,heavy]),
      (12,[medium,none,none,none]),
      (13,[medium,light,none,none]),
      (14,[high,light,strong,light]),
      (15,[medium,none,light,light]),
      (16,[low,heavy,strong,heavy]),
      (17,[low,heavy,light,heavy]),
      (18,[high,none,none,none]),
      (19,[low,light,none,light]),
      (20,[high,none,none,none])]

let aa = hhaa hh

let zzllcsddecoptmm aa rr mmax pmax = fst $ fromJust $ parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionOptimiserFudDecrementingMaxRollByM mmax pmax (sys aa) aa rr fudEmpty (vars aa)  [VarInt i | i <-[10..]]

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ Set.toList $ treesElements $ zzllcsddecoptmm aa (ind aa) 4 1

a
5.08585653022679

Now the result is highest of all of the values for mmax. That is, the model is that of the case above where mmax == 3.

rpln $ aall $ ttaa $ fftt $ hh

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

Re-arranging to show the components,

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

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

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

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

With the maximum-roll-by-derived-dimension maximiser, the derived dimension parameter, mmax, may be set as high as performance limitations allow.

Now consider if the optimisation is predictive of rain.

let (a,hh) = last $ sort $ map (\(a,b) -> (b,a)) $ Set.toList $ treesElements $ zzllcsddecoptmm (aa `red` [cloud,pressure,wind]) (ind (aa `red` [cloud,pressure,wind])) 3 1

a
3.0601487103147385

Again, the alignment density is optimised over all values of mmax. In this case where the tuple partition is constrained to have just two components, let mmax = 2.

rpln $ aall $ aa `fapply` hh
"({(353,1),(354,2)},4 % 1)"
"({(353,2),(354,1)},15 % 1)"
"({(353,2),(354,2)},1 % 1)"

algn $ aa `fapply` hh
6.120297420629477

algnden $ aa `fapply` hh
3.0601487103147385

ent (aa `fapply` hh)
0.6874357505033553

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

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

tlalgn (fftt hh) aa [rain]
9.21757669489453

tlent (fftt hh) aa [rain]
14.862530796657737

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

Again, this rolled model is the least predictive, but is most effective, having $\mathrm{size}((A * T)^{\mathrm{F}} * (V^{\mathrm{C}} * T)) = 60$ states that are underlying effective derived states.

The weather forecast example continues in Limited-underlying tuple set list maximiser.

Another constraint that may be applied to reduce the cardinality of the searched set, $|\mathrm{searched}(Z_{P,A,A_R,F,\mathrm{n},-,K})|$, is to restrict the initial set such that the volume of each component of the tuple partition is limited. The maximum valency is $\mathrm{umax} \in \mathbf{N}_{>0}$. The initial partition-set forming the bottom layer of the decrementing linear fud is in the intersection of the substrate self-cartesian partition-sets set, the pluri-limited-tuple-derived-dimension non-overlapping substrate transforms set and the limited-valency substrate partition-sets set, $\mathcal{N}_{U,K,\mathrm{c}} \cap \mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax}} \cap \mathcal{N}_{U,K,\mathrm{umax}}$. The pluri-limited-valency pluri-limited-tuple-derived-dimension contracted decrementing linear non-overlapping fuds is defined \[ \begin{eqnarray} &&\mathcal{F}_{U,\mathrm{n},-,K,\overline{\mathrm{b}},\mathrm{mmax},\overline{2},\mathrm{umax}}\\ &&\hspace{2em}=\{\{N^{\mathrm{T}} : (\cdot,N) \in L\} : M \in \mathcal{N}_{U,K,\mathrm{c}} \cap \mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax}} \cap \mathcal{N}_{U,K,\mathrm{umax}},\\ &&\hspace{10em}L \in \mathrm{subpaths}(\{(M,\mathrm{tdecp}(U)(M))\})\} \\ &&\hspace{2em}=\{\{N^{\mathrm{T}} : (\cdot,N) \in L\} : Y \in \mathrm{B}(K),~2 \leq |Y| \leq \mathrm{mmax},\\ &&\hspace{10em}(\forall J \in Y~(|J^{\mathrm{C}}| \leq \mathrm{umax})),~M = \{J^{\mathrm{CS}\{\}} : J \in Y\},\\ &&\hspace{10em}L \in \mathrm{subpaths}(\{(M,\mathrm{tdecp}(U)(M))\})\} \end{eqnarray} \] Define the limited-valency contracted decrementing linear non-overlapping fuds list maximiser \[ \begin{eqnarray} &&Z_{P,A,A_R,F,\mathrm{n,w},-,K} =\\ &&\hspace{2em}\mathrm{maximiseLister}(X_{P,A,A_R,F,\mathrm{n},-,K},N_{P,A,A_R,F,\mathrm{n},-,K},\mathrm{top}(\mathrm{pmax}),R_{P,A,A_R,F,\mathrm{n,w},-,K}) \end{eqnarray} \] where the initial set is (Text) \[ \begin{eqnarray} &&R_{P,A,A_R,F,\mathrm{n,w},-,K} = \{(\{M^{\mathrm{T}}\},X_{P,A,A_R,F,\mathrm{n},-,K}(\{M^{\mathrm{T}}\})) : \\ &&\hspace{10em}Y \in \mathrm{B}(K),~2 \leq |Y| \leq \mathrm{mmax},\\ &&\hspace{10em}(\forall J \in Y~(|J^{\mathrm{C}}| \leq \mathrm{umax})),~M = \{J^{\mathrm{CS}\{\}} : J \in Y\}\} \end{eqnarray} \] The cardinality of the initial set now depends on the system, \[ \begin{eqnarray} |R_{P,A,A_R,F,\mathrm{n,w},-,K}| &=& |\mathcal{N}_{U,K,\mathrm{c}} \cap \mathcal{N}_{U,K,\mathrm{n},\overline{\mathrm{b}},\mathrm{mmax}} \cap \mathcal{N}_{U,K,\mathrm{umax}}| \\ &=& \sum_{m \in \{2 \ldots \mathrm{mmax}\}} |\{Y : Y \in \mathrm{S}(K,m),~(\forall J \in Y~(|J^{\mathrm{C}}| \leq \mathrm{umax}))\}| \\ &\leq& \sum_{m \in \{2 \ldots \mathrm{mmax}\}} \mathrm{stir}(|K|,m) \end{eqnarray} \] The cardinality is defined in module AlignmentSubstrate,

systemsSetVarsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthLimitedValencyCardinality :: 
  System -> Set.Set Variable -> Integer -> Integer -> Integer

as

systemsSetVarsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthLimitedValencyCardinality 
  uu vv bmax umax = 
    toInteger $ length [yy | yy <- stirsll vv bmax, dim yy >= 2, and [vol uu jj <= umax | jj <- qqll yy]]
  where
    ...
    stirsll vv bmax = Set.toList $ setsSetPartitionLimited vv bmax

The regular cardinality is defined in module AlignmentSubstrate,

valenciesDimensionsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthLimitedValencyCardinalityReg :: 
  Integer -> Integer -> Integer -> Integer -> Integer

as

valenciesDimensionsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthLimitedValencyCardinalityReg 
  d n bmax umax = 
    sum [c | (mm,c) <- sscdlimpvll n (min n bmax), and [d^j <= umax | (j,q) <- zip [1..] mm, q>0]]
  where
    sscdlimpvll n k = Map.toList $ Map.filterWithKey (\kk _ -> sum kk > 1 && sum kk <= k) (bellcd n)

For example,

let nnvvncpbmaxcdr n bmax = dimensionsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthCardinalityRegular n bmax

let nnvvncpbumaxcdr d n bmax umax = valenciesDimensionsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthLimitedValencyCardinalityReg d n bmax umax

[(d,n,bmax,nnvvncpbumaxcdr d n bmax 100,nnvvncpbmaxcdr n bmax) | d <- [2..5], n <- [1..5], bmax <- [1..5], nnvvncpbumaxcdr d n bmax 100 /= nnvvncpbmaxcdr n bmax]
[(4,5,2,10,15),(4,5,3,35,40),(4,5,4,45,50),(4,5,5,46,51),(5,4,2,3,7),(5,4,3,9,13),(5,4,4,10,14),(5,4,5,10,14),(5,5,2,0,15),(5,5,3,15,40),(5,5,4,25,50),(5,5,5,26,51)]

Note that in some cases the limit $\mathrm{umax}$ is too strict and the cardinality is zero. For example, where the valency $d = 5$, the dimension $n = 5$ and the limited-breadth parameter $\mathrm{bmax} = 2$.

The initial subset function is defined in module AlignmentPracticable,

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

as

parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementingLimitedValency mmax umax uu aa aarr ff kk
  ...
  | ... = Just $ llmm 
      [(ttff (nntt nn), (algn (aa `fmul` gg) - algn (aarr `fmul` gg)) / (w' ** (1/m))) |
        zz <- stirsll kk mmax, dim zz >= 2, and [vol uu jj <= umax | jj <- qqll zz],
        let nn = llqq [self uu jj | jj <- qqll zz],
        let gg = depends ff kk `funion` ttff (nntt nn),
        let ww = fder gg, let w = vol (uu `uunion` fsys gg) ww,
        let w' = fromIntegral w, let m = fromIntegral (Set.size ww)]
  | otherwise = Nothing
  where
    ...
    stirsll vv bmax = Set.toList $ setsSetPartitionLimited vv bmax
    ...

For example,

let nnvvncpbmaxcdr n bmax = dimensionsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthCardinalityRegular n bmax

let nnvvncpbumaxcdr d n bmax umax = valenciesDimensionsLimitsSetSetPartitionCartesianSubstrateNonOverlapPluriLimitedBreadthLimitedValencyCardinalityReg d n bmax umax

let zzcsddecinit aa rr mmax = fromJust $ parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementing mmax (sys aa) aa rr fudEmpty (vars aa)

let zzcsddecinitw aa rr mmax umax = fromJust $ parametersSystemsSamplesShufflesFudsTuplesFunctionInitialFudDecrementingLimitedValency mmax umax (sys aa) aa rr fudEmpty (vars aa)

let aa = resize 90 $ regpivot 3 2 `mul` regtranspose [3] (regcart 3 1)

nnvvncpbmaxcdr 3 4
4

rpln $ zip [0.. ] $ sort $ map (\(ff,a) -> (a, fder (fmpi ff))) $ Map.toList $ zzcsddecinit aa (ind aa) 4
"(0,(0.0,{4,5}))"
"(1,(6.137371702752476,{4,5}))"
"(2,(6.137371702752478,{4,5}))"
"(3,(10.6302396141028,{4,5,6}))"

nnvvncpbumaxcdr 3 3 4 (3^2)
4

rpln $ zip [0.. ] $ sort $ map (\(ff,a) -> (a, fder (fmpi ff))) $ Map.toList $ zzcsddecinitw aa (ind aa) 4 (3^2)
"(0,(0.0,{4,5}))"
"(1,(6.137371702752476,{4,5}))"
"(2,(6.137371702752478,{4,5}))"
"(3,(10.6302396141028,{4,5,6}))"

nnvvncpbumaxcdr 3 3 4 (3^1)
1

rpln $ zip [0.. ] $ sort $ map (\(ff,a) -> (a, fder (fmpi ff))) $ Map.toList $ zzcsddecinitw aa (ind aa) 4 (3^1)
"(0,(10.6302396141028,{4,5,6}))"

Now we continue with the discussion of the optimiser. See section ‘Optimisation’ P694. In the case of the valency limit the choice of tuple fuds is (Text) \[ Q = \mathrm{topd}(\mathrm{pmax})(\mathrm{elements}(Z_{P,A,A_R,F,\mathrm{n,w},-,K})) \] The optimiser function is defined in module AlignmentPracticable,

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

as

parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionOptimiserFudDecrementingLimitedValency 
  mmax umax pmax uu aa aarr ff kk ll
  ...
  | ... = Just $ 
      if gg == [] then ([],(uu,ll)) else (jj,last gg)
  | otherwise = Nothing
  where
    (jj,gg) = unzip $ opt (zzcsddecneigh aa aarr ff) (top pmax) (zzcsddecinit mmax umax uu aa aarr ff kk ll)
    opt pp ii (rr,(uu',ll')) = let mm = ii rr in ((mm,rr),(uu',ll')) : ls mm uu' ll'
      where
        ls mm uu ll = 
          if isempty mm 
          then [] 
          else let (nn,(uu',ll')) = pp mm uu ll; mm' = ii nn in ((mm',nn),(uu',ll')) : ls mm' uu' ll'
    zzcsddecinit =  
      parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionInitialFudDecrementingLimitedValency_u
    zzcsddecneigh aa aarr ff mm uu ll = 
      systemsSamplesShufflesFudsFunctionsListVariablesFunctionNeighbourhoodFudDecrementing_u uu aa aarr ff mm ll
    ...

Note that, again, the partition variables are replaced by cardinal variables, so the optimiser function has an additional argument of a list of variables, [Variable].

For example,

let zzcsddecopt aa rr mmax pmax = fromJust $ parametersSystemsSamplesShufflesFudsTuplesFunctionOptimiserFudDecrementing mmax pmax (sys aa) aa rr fudEmpty (vars aa)

let zzllcsddecoptw aa rr mmax umax pmax = fst $ fromJust $ parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionOptimiserFudDecrementingLimitedValency mmax umax pmax (sys aa) aa rr fudEmpty (vars aa)  [VarInt i | i <-[10..]]

let aa = resize 90 $ regpivot 3 2 `mul` regtranspose [3] (regcart 3 1)

rpln $ zip [0.. ] $ map (sort . Map.elems) $ snd $ unzip $ zzcsddecopt aa (ind aa) 3 1
"(0,[0.0,6.137371702752476,6.137371702752478,10.6302396141028])"
"(1,[2.8026431226723085,2.8026431226723085,...,13.350624478517439,13.350624478517457])"
"(2,[3.5501620380141903,3.5501620380141903,...,16.16224874264553,16.16224874264553])"
"(3,[4.04480505714146,4.04480505714146,19.61378180167165])"
"(4,[])"

rpln $ zip [0.. ] $ map (sort . Map.elems) $ snd $ unzip $ zzllcsddecoptw aa (ind aa) 3 (3^2) 1
"(0,[0.0,6.137371702752476,6.137371702752478,10.6302396141028])"
"(1,[2.8026431226723085,2.8026431226723085,...,13.350624478517439,13.350624478517457])"
"(2,[3.5501620380141903,3.5501620380141903,...,16.16224874264553,16.16224874264553])"
"(3,[4.04480505714146,4.04480505714146,19.61378180167165])"
"(4,[])"

rpln $ zip [0.. ] $ map (sort . Map.elems) $ snd $ unzip $ zzllcsddecoptw aa (ind aa) 3 (3^1) 1
"(0,[10.6302396141028])"
"(1,[2.8026431226723085,2.8026431226723085,...,13.350624478517439,13.350624478517457])"
"(2,[3.5501620380141903,3.5501620380141903,...,16.16224874264553,16.16224874264553])"
"(3,[4.04480505714146,4.04480505714146,19.61378180167165])"
"(4,[])"

The maximum cardinality of the worst-case searched is \[ \begin{eqnarray} &&\mathrm{maxr}(\{(Y,\mathrm{srchmax}(Y)) : m \in \{2 \ldots \mathrm{mmax}\},\\ &&\hspace{10em}Y \in \mathrm{S}(K,m),~(\forall J \in Y~(|J^{\mathrm{C}}| \leq \mathrm{umax}))\}) \in \mathbf{N}_{>0} \end{eqnarray} \] In the case of a regular tuple of dimension $k=|K|$ and valency $d$, the maximum cardinality of the worst-case searched is \[ \begin{eqnarray} &&\mathrm{maxr}(\{(L, a \times \mathrm{srchmax}(L)) : m \in \{2 \ldots \mathrm{mmax}\},\\ &&\hspace{10em}(L,a) \in \mathrm{sscd}(k,m),~(\forall (j,p) \in L~(d^j \leq \mathrm{umax}))\}) \in \mathbf{N}_{>0} \end{eqnarray} \]

A cardinality list function of $(\mathrm{srchmax}(Y) : m \in \{2 \ldots \mathrm{mmax}\},~Y \in \mathrm{S}(K,m),~(\forall J \in Y~(|J^{\mathrm{C}}| \leq \mathrm{umax})))$ is defined in module AlignmentSubstrate,

systemsSetVarsLimitsSetSetPartitionCartesianSubstrateNonOvTreeDecSubsSelfPluriLimBrPluriLimValChMaxListCard ::
  System -> Set.Set Variable -> Integer -> Integer -> Maybe [Integer]

as

systemsSetVarsLimitsSetSetPartitionCartesianSubstrateNonOvTreeDecSubsSelfPluriLimBrPluriLimValChMaxListCard
  uu vv bmax umax
  ...
  | ... = Just $ 
    [mx 0 ll | yy <- stirsll vv bmax, dim yy >= 2, and [vol uu jj <= umax | jj <- qqll yy], 
               let ll = sort [v | jj <- qqll yy, let v = vol uu jj, v > 2]]
  | otherwise = Nothing
  where
    ...

A cardinality list function for the regular case of $(a \times \mathrm{srchmax}(L) : m \in \{2 \ldots \mathrm{mmax}\},~(L,a) \in \mathrm{sscd}(k,m),~(\forall (j,p) \in L~(d^j \leq \mathrm{umax})))$ is also defined in module AlignmentSubstrate,

valenciesDimensionsLimitsSetSetPartitionCartesianSubsNonOvTreeDecSubsSelfPluriLimBrPluriLimValChMaxListCardReg :: 
  Integer -> Integer -> Integer -> Integer -> Maybe [Integer]

as

valenciesDimensionsLimitsSetSetPartitionCartesianSubsNonOvTreeDecSubsSelfPluriLimBrPluriLimValChMaxListCardReg 
  d n bmax umax
  | n >= 0 && d > 0 && bmax >= 0 = Just $ 
      concat [replicate (fromInteger a) (mx 0 mm) | (ll,a) <- sscdlimpvll n (min n bmax), 
            and [d^j <= umax | (j,q) <- zip [1..] ll, q>0],      
            let mm = sort (concat [replicate (fromInteger p) (d^j) | (j,p) <- zip [1..] ll, d^j > 2])]
  | otherwise = Nothing
  where
    ...

We can now compute the search worst cases. For example,

let nnvvnctnsdbmaxpvchcdsr d n bmax = fromJust $ valenciesDimensionsLimitsSetSetPartitionCartesianSubsNonOvTreeDecSubsSelfPluriLimBrPluriValChoiceMaxListCardReg d n bmax

let nnvvnctnsdbumaxpvchcdsr d n bmax umax = fromJust $ valenciesDimensionsLimitsSetSetPartitionCartesianSubsNonOvTreeDecSubsSelfPluriLimBrPluriLimValChMaxListCardReg d n bmax umax


sort $ nnvvnctnsdbmaxpvchcdsr 3 3 3
[18,158,158,158]

sort $ nnvvnctnsdbumaxpvchcdsr 3 3 3 (3^2)
[18,158,158,158]

sort $ nnvvnctnsdbumaxpvchcdsr 3 3 3 (3^1)
[18]

sort $ nnvvnctnsdbmaxpvchcdsr 3 3 2
[158,158,158]

sort $ nnvvnctnsdbumaxpvchcdsr 3 3 2 (3^1)
[]

sort $ nnvvnctnsdbmaxpvchcdsr 3 4 4
[30,200,200,200,200,200,200,490,490,490,3629,3629,3629,3629]

sort $ nnvvnctnsdbumaxpvchcdsr 3 4 4 (3^3)
[30,200,200,200,200,200,200,490,490,490,3629,3629,3629,3629]

sort $ nnvvnctnsdbumaxpvchcdsr 3 4 4 (3^2)
[30,200,200,200,200,200,200,490,490,490]

sort $ nnvvnctnsdbumaxpvchcdsr 3 4 4 (3^1)
[30]

sort $ nnvvnctnsdbmaxpvchcdsr 3 4 3
[200,200,200,200,200,200,490,490,490,3629,3629,3629,3629]

sort $ nnvvnctnsdbumaxpvchcdsr 3 4 3 (3^3)
[200,200,200,200,200,200,490,490,490,3629,3629,3629,3629]

sort $ nnvvnctnsdbumaxpvchcdsr 3 4 3 (3^2)
[200,200,200,200,200,200,490,490,490]

sort $ nnvvnctnsdbumaxpvchcdsr 3 4 3 (3^1)
[]

Tuple partitioner

In order to implement the limited-valency contracted decrementing linear non-overlapping fuds list maximiser initial set, $R_{P,A,A_R,F,\mathrm{n,w},-,K}$, (Haskell) the tuple partitioner $I_{P,U,\mathrm{K}} \in \mathrm{computers}$ is defined such that (i) $\mathrm{domain}(I_{P,U,\mathrm{K}}) = (\mathrm{P}(\mathcal{V}_U) \times \mathcal{A}_U \times \mathcal{A}_U) \times \mathbf{Q}$, (ii) $\mathrm{range}(I_{P,U,\mathrm{K}}) = \mathrm{P}(\mathcal{L}(\mathcal{S}_U \to \mathbf{N}) \times \mathcal{A}_U \times \mathcal{A}_U)$, and (iii) the application is (Text) \[ \begin{eqnarray} &&I_{P,U,\mathrm{K}}^{ * }(((K,B,B_R),y_1)) = \\ &&\hspace{1em}\mathrm{topd}(\mathrm{pmax})(\{((N,C,C_R),~((y_1-a_2+b_2)/c,~b_2/c,~-m,~D_{\mathcal{X}}(J))) :\\ &&\hspace{2em}m \in \{2 \ldots \mathrm{mmax}\},~Y \in \mathrm{S}(K,m),~(\forall J \in Y~(|J^{\mathrm{C}}| \leq \mathrm{umax})),\\ &&\hspace{2em}N = \{(i,\mathrm{order}(D_{\mathrm{S}},J^{\mathrm{CS}})) : (J,i) \in \mathrm{order}(D_{\mathrm{P}(\mathcal{V})},Y)\},\\ &&\hspace{2em}T=(\{\bigcup \{S \cup \{(w,u)\} : (w,(S,u)) \in L\} : L \in \prod N\}^{\mathrm{U}},\{1 \ldots m\}),\\ &&\hspace{2em}C = I_{ * \mathrm{T}}^{ * }((T,B)),~C_R = I_{ * \mathrm{T}}^{ * }((T,B_R)),\\ &&\hspace{2em}a_2 = I_{\mathrm{\mathrm{S}\approx\mathrm{ln}!}}^{ * }(I_{\mathrm{X}}^{ * }(C)),~b_2 = I_{\mathrm{\mathrm{S}\approx\mathrm{ln}!}}^{ * }(I_{\mathrm{X}}^{ * }(C_R)),~c=I_{\approx\mathrm{pow}}^{ * }((v,1/m))\}) \end{eqnarray} \] where $v = |K^{\mathrm{C}}|$, $\mathrm{vars}(U) \cap \mathbf{N} = \emptyset$, $D_{\mathrm{S}} \in \mathrm{enums}(\mathcal{S}_U)$, $D_{\mathrm{P}(\mathcal{V})} \in \mathrm{enums}(\mathrm{P}(\mathcal{V}_U))$, and the transformer $I_{\mathrm{ * T}} = \mathrm{transformer} \in \mathrm{computers}$ is such that $I_{ * \mathrm{T}}^{ * }((T,A)) = A * T$.

The tuple partitioner is defined in module AlignmentPracticable,

parametersSystemsPartitioner :: 
  Integer -> Integer -> Integer -> System -> Set.Set Variable -> Histogram -> Histogram -> Double ->
  Maybe (Set.Set ([Set.Set (State,Int)], Histogram, Histogram))

as

parametersSystemsPartitioner mmax umax pmax uu kk bb bbrr y1
  ...
  | otherwise = Just $ topd pmax $ llmm [((nn, cc, ccrr), ((y1-a2+b2)/c, b2, -m)) |
        yy <- stirsll kk mmax, dim yy >= 2, and [vol uu jj <= umax | jj <- qqll yy],
        let m = fromIntegral $ dim yy,
        let nn = [llqq (zip (qqll (cart uu jj)) [0..]) | jj <- qqll yy],
        let tt = trans (unit [foldl sunion sempty [ss `sunion` ssgl (VarIndex w) (ValIndex u) | 
                       (w,(ss,u)) <- zip [0..] ll] | ll <- qqll (prod nn)]) 
                       (llqq [VarIndex (fromInteger w) | w <- [0 .. dim yy - 1]]),
        let cc = bb `tmul` tt, let ccrr = bbrr `tmul` tt,
        let a2 = sumfacln (ind cc), let b2 = sumfacln (ind ccrr), let c = v ** (1/m)]
  where
    v = fromIntegral $ vol uu kk
    ...

For example,

let zzllcsddecinitw aa rr mmax umax = fst $ parametersSystemsSamplesShufflesFudsTuplesListVariablesFunctionInitialFudDecrementingLimitedValency_u mmax umax (sys aa) aa rr fudEmpty (vars aa) [VarInt i | i <-[101..]]

let facln x = logGamma (x + 1)

let sumfacln aa = sum [facln (fromRational c) | (_,c) <- aall aa]

let parter aa rr mmax umax pmax = map (map (statesSetVar . head . fst . unzip . Set.toList) . (\(x,_,_) -> x)) $ Set.toList $ fromJust $ parametersSystemsPartitioner mmax umax pmax (sys aa) (vars aa) aa rr (sumfacln aa - sumfacln rr)


let aa = resize 90 $ regpivot 3 2 `mul` regtranspose [3] (regcart 3 1)

rpln $ sort $ map (\(ff,a) -> (a, fder ff)) $ Map.toList $ zzllcsddecinitw aa (ind aa) 4 (3^2)
"(23.076167064285883,{117,118})"
"(23.076167064285883,{122,123})"
"(23.076167064285883,{127,128})"
"(93.29740701617027,{105,106,107})"
"(93.29740701617027,{108,109,110})"
"(93.29740701617027,{111,112,113})"
"(93.29740701617027,{114,115,116})"
"(93.29740701617027,{119,120,121})"
"(93.29740701617027,{124,125,126})"
"(197.70429785167653,{101,102,103,104})"

rpln $ sort $ map (\(ff,a) -> (a, map und (Set.toList (ffqq ff)))) $ Map.toList $ zzllcsddecinitw aa (ind aa) 4 (3^2)
"(23.076167064285883,[{1,2},{3,4}])"
"(23.076167064285883,[{1,3},{2,4}])"
"(23.076167064285883,[{1,4},{2,3}])"
"(93.29740701617027,[{1},{2},{3,4}])"
"(93.29740701617027,[{1},{2,3},{4}])"
"(93.29740701617027,[{1},{2,4},{3}])"
"(93.29740701617027,[{1,2},{3},{4}])"
"(93.29740701617027,[{1,3},{2},{4}])"
"(93.29740701617027,[{1,4},{2},{3}])"
"(197.70429785167653,[{1},{2},{3},{4}])"

rpln $ parter aa (ind aa) 4 (3^2) 3
"[{1},{2},{3},{4}]"
"[{1,3},{2},{4}]"
"[{1,4},{2},{3}]"

Maximum-roll-by-derived-dimension tuple partitioner

In order to implement the maximum-roll-by-derived-dimension limited-valency contracted decrementing linear non-overlapping fuds list maximiser initial set, $R_{P,A,A_R,F,\mathrm{n,w},-,K,\mathrm{mm}}$, (Haskell) the maximum-roll-by-derived-dimension tuple partitioner $I_{P,U,\mathrm{K},\mathrm{mm}} \in \mathrm{computers}$ is defined such that (i) $\mathrm{domain}(I_{P,U,\mathrm{K},\mathrm{mm}}) = (\mathrm{P}(\mathcal{V}_U) \times \mathcal{A}_U \times \mathcal{A}_U) \times \mathbf{Q}$, (ii) $\mathrm{range}(I_{P,U,\mathrm{K},\mathrm{mm}}) = \mathrm{P}(\mathcal{L}(\mathcal{S}_U \to \mathbf{N}) \times \mathcal{A}_U \times \mathcal{A}_U)$, and (iii) the application is (Text) \[ \begin{eqnarray} &&I_{P,U,\mathrm{K},\mathrm{mm}}^{ * }(((K,B,B_R),y_1)) = \\ &&\hspace{1em}\bigcup \{\mathrm{topd}(\mathrm{pmax})(\{((N,C,C_R),~((y_1-a_2+b_2)/c,~b_2/c,~-m,~D_{\mathcal{X}}(J))) :\\ &&\hspace{3em}Y \in \mathrm{S}(K,m),~(\forall J \in Y~(|J^{\mathrm{C}}| \leq \mathrm{umax})),\\ &&\hspace{3em}N = \{(i,\mathrm{order}(D_{\mathrm{S}},J^{\mathrm{CS}})) : (J,i) \in \mathrm{order}(D_{\mathrm{P}(\mathcal{V})},Y)\},\\ &&\hspace{3em}T=(\{\bigcup \{S \cup \{(w,u)\} : (w,(S,u)) \in L\} : L \in \prod N\}^{\mathrm{U}},\{1 \ldots m\}),\\ &&\hspace{3em}C = I_{ * \mathrm{T}}^{ * }((T,B)),~C_R = I_{ * \mathrm{T}}^{ * }((T,B_R)),\\ &&\hspace{3em}a_2 = I_{\mathrm{\mathrm{S}\approx\mathrm{ln}!}}^{ * }(I_{\mathrm{X}}^{ * }(C)),~b_2 = I_{\mathrm{\mathrm{S}\approx\mathrm{ln}!}}^{ * }(I_{\mathrm{X}}^{ * }(C_R)),~c=I_{\approx\mathrm{pow}}^{ * }((v,1/m))\}) : \\ &&\hspace{2em}m \in \{2 \ldots \mathrm{mmax}\}\} \end{eqnarray} \]

The tuple partitioner is defined in module AlignmentPracticable,

parametersSystemsPartitionerMaxRollByM :: 
  Integer -> Integer -> Integer -> System -> Set.Set Variable -> Histogram -> Histogram -> Double ->
  Maybe (Set.Set ([Set.Set (State,Int)], Histogram, Histogram))

as

parametersSystemsPartitionerMaxRollByM mmax umax pmax uu kk bb bbrr y1
  ...
  | otherwise = Just $ llqq (concat [topd pmax [((nn, cc, ccrr), ((y1-a2+b2)/c, b2, -m)) |
        yy <- stirsll kk m, and [vol uu jj <= umax | jj <- qqll yy],   
        let nn = [llqq (zip (qqll (cart uu jj)) [0..]) | jj <- qqll yy],
        let tt = trans (unit [foldl sunion sempty [ss `sunion` ssgl (VarIndex w) (ValIndex u) | 
                       (w,(ss,u)) <- zip [0..] ll] | ll <- qqll (prod nn)]) 
                       (llqq [VarIndex (fromInteger w) | w <- [0 .. m-1]]),
        let cc = bb `tmul` tt, let ccrr = bbrr `tmul` tt,
        let a2 = sumfacln (ind cc), let b2 = sumfacln (ind ccrr)] | 
          m <- [2 .. mmax], let c = v ** (1 / fromIntegral m)])
  where
    v = fromIntegral $ vol uu kk
    ...

For example,

let facln x = logGamma (x + 1)
let sumfacln aa = sum [facln (fromRational c) | (_,c) <- aall aa]

let parter aa rr mmax umax pmax = map (map (statesSetVar . head . fst . unzip . Set.toList) . (\(x,_,_) -> x)) $ Set.toList $ fromJust $ parametersSystemsPartitioner mmax umax pmax (sys aa) (vars aa) aa rr (sumfacln aa - sumfacln rr)

let partermm aa rr mmax umax pmax = map (map (statesSetVar . head . fst . unzip . Set.toList) . (\(x,_,_) -> x)) $ Set.toList $ fromJust $ parametersSystemsPartitionerMaxRollByM mmax umax pmax (sys aa) (vars aa) aa rr (sumfacln aa - sumfacln rr)


let aa = resize 1000 $ regpivot 3 2 `mul` cdrefr [3,4] (regdiag 3 2)

rpln $ parter aa (ind aa) 4 (3^3) 1
"[{1},{2},{3},{4}]"

rpln $ partermm aa (ind aa) 4 (3^3) 1
"[{1},{2},{3},{4}]"
"[{1,4},{2},{3}]"
"[{1,4},{2,3}]"

rpln $ parter aa (ind aa) 4 (3^3) 2
"[{1},{2},{3},{4}]"
"[{1,4},{2},{3}]"

rpln $ partermm aa (ind aa) 4 (3^3) 2
"[{1},{2},{3},{4}]"
"[{1,3},{2},{4}]"
"[{1,3},{2,4}]"
"[{1,4},{2},{3}]"
"[{1,4},{2,3}]"

rpln $ parter aa (ind aa) 3 (3^3) 1
"[{1,4},{2},{3}]"

rpln $ partermm aa (ind aa) 3 (3^3) 1
"[{1,4},{2},{3}]"
"[{1,4},{2,3}]"

rpln $ parter aa (ind aa) 3 (3^3) 2
"[{1,3},{2},{4}]"
"[{1,4},{2},{3}]"

rpln $ partermm aa (ind aa) 3 (3^3) 2
"[{1,3},{2},{4}]"
"[{1,3},{2,4}]"
"[{1,4},{2},{3}]"
"[{1,4},{2,3}]"

Tuple-partition value roller

After constructing the initial set in a tuple partitioner, $I_{P,U,\mathrm{K}}$, the remainder of the limited-valency contracted decrementing linear non-overlapping fuds list maximiser, $Z_{P,A,A_R,F,\mathrm{n,w},-,K}$, (Haskell) is implemented by means of value roll computers, defined in section ‘Value roll computers’. The tuple-partition value roller $I_{P,U,\mathrm{R}} \in \mathrm{computers}$ is defined such that (i) the domain is $\mathrm{domain}(I_{P,U,\mathrm{R}}) = \mathrm{P}(\mathcal{L}(\mathcal{S}_U \to \mathbf{N}) \times \mathcal{A}_U \times \mathcal{A}_U)$, (ii) the range is $\mathrm{range}(I_{P,U,\mathrm{R}}) = \mathrm{P}(\mathcal{L}(\mathcal{S}_U \to \mathbf{N}))$, and (iii) the application is (Text) \[ \begin{eqnarray} &&I_{P,U,\mathrm{R}}^{ * }(Q) = \\ &&\hspace{1em}\{N’ :\\ &&\hspace{2em}M = \{((N,R_A,R_B),(a-b)/c) : \\ &&\hspace{6em}(N,A,B) \in Q,\\ &&\hspace{6em}a=I_{\mathrm{a}}^{ * }(A),~b=I_{\mathrm{a}}^{ * }(B),\\ &&\hspace{6em}w = \prod_{(\cdot,I) \in N} |\mathrm{ran}(I)|,~m =|N|,~c = I_{\approx\mathrm{pow}}^{ * }((w,1/m)),\\ &&\hspace{6em}R_A = (a,A,I_{\mathrm{X}}^{ * }(A)),~R_B = (b,B,I_{\mathrm{X}}^{ * }(B))\}, \\ &&\hspace{2em}(N’,\cdot,\cdot) \in \mathrm{topd}(\mathrm{pmax})(\mathrm{rollb}(M,M))\} \end{eqnarray} \] where $\mathrm{rollb} \in \mathrm{rollbt} \times \mathrm{rollbt} \to \mathrm{rollbt}$, where $\mathrm{rollbt} = \mathcal{L}(\mathcal{S}_U \to \mathbf{N}) \times (\mathbf{Q} \times \mathcal{A}_U \times \mathcal{A}_U)^2 \to \mathbf{Q}$, is defined \[ \begin{eqnarray} &&\mathrm{rollb}(Q,P) = \\ &&\hspace{1em}\mathrm{if}(M \neq \emptyset, \mathrm{rollb}(M,P \cup M),P) : \\ &&\hspace{2em}M = \mathrm{top}(\mathrm{pmax})(\{((N’,R’_A,R’_B), (a’-b’)/c’) :\\ &&\hspace{4em}((N,R_A,R_B),\cdot) \in Q,\\ &&\hspace{4em}V=\mathrm{dom}(N),~(\cdot,A,A_{\mathrm{X}}) = R_A,~(\cdot,B,B_{\mathrm{X}}) = R_B,\\ &&\hspace{4em}Y_A = \mathrm{rals}(N,A,A_{\mathrm{X}}),~Y_B = \mathrm{rals}(N,B,B_{\mathrm{X}}),\\ &&\hspace{4em}(v,I) \in N,~|\mathrm{ran}(I)|>2,~s,t \in \mathrm{ran}(I),~s > t,\\ &&\hspace{4em}N’ = N \setminus \{(v,I)\} \cup \{(v,\{(s,t)\} \circ I)\},\\ &&\hspace{4em}R’_A = I_{\mathrm{R,a}}^{ * }(((V,v,s,t),Y_A,R_A)),\\ &&\hspace{4em}R’_B = I_{\mathrm{R,a}}^{ * }(((V,v,s,t),Y_B,R_B)),\\ &&\hspace{4em}(a’,\cdot,\cdot) = R’_A,~(b’,\cdot,\cdot) = R’_B,\\ &&\hspace{4em}w = \prod_{(\cdot,I’) \in N’} |\mathrm{ran}(I’)|,~m =|V|,~c’ = I_{\approx\mathrm{pow}}^{ * }((w,1/m)) \}) \end{eqnarray} \] where $I_{\mathrm{R,a}} = \mathrm{rollValueAlignmenter} \in \mathrm{computers}$ is defined as \[ \begin{eqnarray} &&I_{\mathrm{R,a}}^{ * }(((V,v,s,t), Y, (a,A,A^{\mathrm{X}})) = \\ &&\hspace{2em}(I^{ * }_{\mathrm{a}}(A * (V,v,s,t)^{\mathrm{R}}), A * (V,v,s,t)^{\mathrm{R}},(A * (V,v,s,t)^{\mathrm{R}})^{\mathrm{X}}) \end{eqnarray} \] and $\mathrm{rals} \in \mathcal{L}(\mathcal{S}_U \to \mathbf{N}) \times \mathcal{A} \times \mathcal{A} \to (\mathcal{V} \to (\mathcal{S} \to \mathbf{Q}))$ is defined as \[ \begin{eqnarray} &&\mathrm{rals}(N,A,A_{\mathrm{X}}) := \\ &&\hspace{2em}\{(w,\{(S, \sum (I_{\mathrm{\approx\mathrm{ln}!}}^{ * }(A(T)) : T \in A^{\mathrm{S}},~T \supseteq S) - \\ &&\hspace{5em}\sum (I_{\mathrm{\approx\mathrm{ln}!}}^{ * }(A_{\mathrm{X}}(T)) : T \in A_{\mathrm{X}}^{\mathrm{S}},~T \supseteq S)) : \\ & &\hspace{7em}u \in \mathrm{ran}(N_w),~S = \{(w,u)\}\}) : w \in \mathrm{dom}(N)\} \end{eqnarray} \]

The roller is defined in module AlignmentPracticable,

parametersRoller :: 
  Integer -> Set.Set ([Set.Set (State,Int)], Histogram, Histogram) -> Maybe (Set.Set [Set.Set (State,Int)])

as

parametersRoller pmax qq
  ...
  | otherwise = Just $ llqq [nn' | (nn',_,_) <- qqll (topd pmax (rollb mm mm))]
  where
    mm = llmm [((nn,rraa,rrbb),(a-b)/c) | (nn,aa,bb) <- qqll qq, let a = algn aa, let b = algn bb,
               let w = fromIntegral (product [card (ran ii) | ii <- nn]), let m = fromIntegral (length nn),
               let c = w ** (1/m), let rraa = (a, aa, ind aa), let rrbb = (b, bb, ind bb)]
    rollb qq pp
      | mm /= empty = rollb mm (pp `union` mm)
      | otherwise = pp         
      where
        mm = top pmax $ llmm [((nn',rraa',rrbb'),(a'-b')/c') | ((nn,rraa,rrbb),_) <- mmll qq, 
               let vv = llqq (map VarIndex [0 .. length nn - 1]), 
               let (_,aa,aaxx) = rraa, let (_,bb,bbxx) = rrbb,
               let yyaa = rals nn aa aaxx, let yybb = rals nn bb bbxx,
               (v,ii) <- zip [0..] nn, card (ran ii) > 2, s <- qqll (ran ii), t <- qqll (ran ii), s > t, 
               let nn' = take v nn ++ [(ii `join` sgl (s,t))] ++ drop (v+1) nn,              
               let rv = vvvstrv (vv, VarIndex v, ValIndex s, ValIndex t),
               let rraa' = algner rv yyaa rraa, let rrbb' = algner rv yybb rrbb,
               let (a',_,_) = rraa', let (b',_,_) = rrbb',
               let w = fromIntegral (product [card (ran ii') | ii' <- nn']), let m = fromIntegral (card vv),
               let c' = w ** (1/m)]
    rals nn aa aaxx = llmm [(v, llmm [(ss, sumfacln (aa `mul` unit (sgl ss)) - sumfacln (aaxx `mul` unit (sgl ss))) | 
                              u <- (map ValIndex . snd . unzip . qqll) ii, let ss = ssgl v u]) | 
                               (v,ii) <- zip (map VarIndex [0..]) nn]
    algner rv yy (a,aa,aaxx) = rollValueAlignmenter_u rv yy a aa aaxx
    vvvstrv xx = fromJust $ setVariablesVariablesValuesValuesRollValue xx
    ...

The roll value alignmenter is defined in module AlignmentPracticable,

rollValueAlignmenter_u :: RollValue -> Map.Map Variable (Map.Map State Double) -> Double -> Histogram -> Histogram -> 
  (Double, Histogram, Histogram) 

as

rollValueAlignmenter_u rv yy a aa bb 
  | s==t = (a, aa, bb)
  | otherwise = (a', aa', bb')
  where
    (vv,v,s,t) = rvvvvst rv
    (aa',bb') = rollValuer rv aa bb
    r' = sumfacln (aa' `mul` unit (ssgl v t)) - 
         sumfacln (bb' `mul` unit (ssgl v t))
    a' = a - (yy Map.! v Map.! ssgl v s) - (yy Map.! v Map.! ssgl v t) + r'
    ...

The roll valuer is defined in module AlignmentPracticable,

rollValuer :: RollValue -> Histogram -> Histogram -> (Histogram, Histogram) 

as

rollValuer rv aa bb
  | s==t = (aa, bb)
  | otherwise = (rollv v s t aa, rollv v s t bb)
  where
    (_,v,s,t) = rvvvvst rv
    ...
    rollv v s t aa = aa `mul` unit (ssgl v t) `add` 
          llaa [(ss `sminus` ssgl v s `sunion` ssgl v t, c) | (ss,c) <- aall (aa `mul` unit (ssgl v s))] `add` 
          (aa `sub` (aa `mul` (unit (ssgl v s) `add` unit (ssgl v t))))
    ...

Maximum-roll tuple-partition value roller

Consider 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) which only applies the $\mathrm{pmax}$ parameter to the initial set. The tuple partitioner, $I_{P,U,\mathrm{K}}$, is unchanged and the tuple-partition value roller, $I_{P,U,\mathrm{R}}$, is modified to use the $\mathrm{max}$ inclusion function instead of $\mathrm{top}(\mathrm{pmax})$. The maximum-roll tuple-partition value roller $I_{P,U,\mathrm{R,mr}} \in \mathrm{computers}$ is defined such that (i) the domain is $\mathrm{domain}(I_{P,U,\mathrm{R,mr}}) = \mathcal{L}(\mathcal{S}_U \to \mathbf{N}) \times \mathcal{A}_U \times \mathcal{A}_U$, (ii) the range is $\mathrm{range}(I_{P,U,\mathrm{R,mr}}) = \mathrm{P}(\mathcal{L}(\mathcal{S}_U \to \mathbf{N}))$, and (iii) the application is (Text) \[ \begin{eqnarray} &&I_{P,U,\mathrm{R,mr}}^{ * }((N,A,B)) = \\ &&\hspace{1em}\{N’ :\\ &&\hspace{2em}M = \{((N,R_A,R_B),(a-b)/c) : \\ &&\hspace{6em}a=I_{\mathrm{a}}^{ * }(A),~b=I_{\mathrm{a}}^{ * }(B),\\ &&\hspace{6em}w = \prod_{(\cdot,I) \in N} |\mathrm{ran}(I)|,~m =|N|,~c = I_{\approx\mathrm{pow}}^{ * }((w,1/m)),\\ &&\hspace{6em}R_A = (a,A,I_{\mathrm{X}}^{ * }(A)),~R_B = (b,B,I_{\mathrm{X}}^{ * }(B))\}, \\ &&\hspace{2em}(N’,\cdot,\cdot) \in \mathrm{maxd}(\mathrm{rollb}(M,M))\} \end{eqnarray} \] and \[ \begin{eqnarray} &&\mathrm{rollb}(Q,P) = \\ &&\hspace{1em}\mathrm{if}(M \neq \emptyset, \mathrm{rollb}(M,P \cup M),P) : \\ &&\hspace{2em}M = \mathrm{max}(\{((N’,R’_A,R’_B), (a’-b’)/c’) :\\ &&\hspace{4em}((N,R_A,R_B),\cdot) \in Q,\\ &&\hspace{4em}V=\mathrm{dom}(N),~(\cdot,A,A_{\mathrm{X}}) = R_A,~(\cdot,B,B_{\mathrm{X}}) = R_B,\\ &&\hspace{4em}Y_A = \mathrm{rals}(N,A,A_{\mathrm{X}}),~Y_B = \mathrm{rals}(N,B,B_{\mathrm{X}}),\\ &&\hspace{4em}(v,I) \in N,~|\mathrm{ran}(I)|>2,~s,t \in \mathrm{ran}(I),~s > t,\\ &&\hspace{4em}N’ = N \setminus \{(v,I)\} \cup \{(v,\{(s,t)\} \circ I)\},\\ &&\hspace{4em}R’_A = I_{\mathrm{R,a}}^{ * }(((V,v,s,t),Y_A,R_A)),\\ &&\hspace{4em}R’_B = I_{\mathrm{R,a}}^{ * }(((V,v,s,t),Y_B,R_B)),\\ &&\hspace{4em}(a’,\cdot,\cdot) = R’_A,~(b’,\cdot,\cdot) = R’_B,\\ &&\hspace{4em}w = \prod_{(\cdot,I’) \in N’} |\mathrm{ran}(I’)|,~m =|V|,~c’ = I_{\approx\mathrm{pow}}^{ * }((w,1/m)) \}) \end{eqnarray} \] The maximum-roll roller is implemented simply by constraining the pmax argument to be equal to 1,

parametersRoller 1
  :: Set.Set ([Set.Set (State, Int)], Histogram, Histogram) -> Maybe (Set.Set [Set.Set (State, Int)])

top