SplittingTree(V, C)¶
newdata.spad line 295 [edit on github]
V: Join(SetCategory, Aggregate)
C: Join(SetCategory, Aggregate)
This domain exports a modest implementation of splitting trees. Splitting trees are needed when the evaluation of some quantity under some hypothesis requires to split the hypothesis into sub-cases. For instance by adding some new hypothesis on one hand and its negation on another hand. The computations are terminated for a splitting tree a
when status(value(a))
is true
. Thus, if for the splitting tree a
the flag status(value(a))
is true
, then status(value(d))
is true
for any subtree d
of a
. This property of splitting trees is called the termination condition. If no vertex in a splitting tree a
is equal to another, a
is said to satisfy the no-duplicates condition. The splitting tree a
will satisfy this condition if nodes are added to a
by means of splitNodeOf!
and if construct
is only used to create the root of a
with no children.
- #: % -> NonNegativeInteger
from Aggregate
- any?: (SplittingNode(V, C) -> Boolean, %) -> Boolean
from HomogeneousAggregate SplittingNode(V, C)
- child?: (%, %) -> Boolean
from RecursiveAggregate SplittingNode(V, C)
- children: % -> List %
from RecursiveAggregate SplittingNode(V, C)
- coerce: % -> OutputForm
from CoercibleTo OutputForm
- conditions: % -> List C
conditions(a)
returns the list of the conditions of the leaves of a
- construct: (V, C, List %) -> %
construct(v, t, la)
creates a splitting tree with value (i.e. root vertex) given by[v, t]\$S
and withla
as children list.
- construct: (V, C, List SplittingNode(V, C)) -> %
construct(v, t, ls)
creates a splitting tree with value (i.e. root vertex) given by[v, t]\$S
and with children list given by[[s]\$\% for s in ls]
.
- construct: (V, C, V, List C) -> %
construct(v1, t, v2, lt)
creates a splitting tree with value (i.e. root vertex) given by[v, t]\$S
and with children list given by[[[v, t]\$S]\$\% for s in ls]
.
- construct: SplittingNode(V, C) -> %
construct(s)
creates a splitting tree with value (i.e. root vertex) given bys
and no children. Thus, if the status ofs
isfalse
,[s]
represents the starting point of the evaluationvalue(s)
under the hypothesiscondition(s)
.
- count: (SplittingNode(V, C) -> Boolean, %) -> NonNegativeInteger
from HomogeneousAggregate SplittingNode(V, C)
- count: (SplittingNode(V, C), %) -> NonNegativeInteger
from HomogeneousAggregate SplittingNode(V, C)
- cyclic?: % -> Boolean
from RecursiveAggregate SplittingNode(V, C)
- distance: (%, %) -> Integer
from RecursiveAggregate SplittingNode(V, C)
- elt: (%, value) -> SplittingNode(V, C)
from RecursiveAggregate SplittingNode(V, C)
- eval: (%, Equation SplittingNode(V, C)) -> % if SplittingNode(V, C) has Evalable SplittingNode(V, C)
from Evalable SplittingNode(V, C)
- eval: (%, List Equation SplittingNode(V, C)) -> % if SplittingNode(V, C) has Evalable SplittingNode(V, C)
from Evalable SplittingNode(V, C)
- eval: (%, List SplittingNode(V, C), List SplittingNode(V, C)) -> % if SplittingNode(V, C) has Evalable SplittingNode(V, C)
from InnerEvalable(SplittingNode(V, C), SplittingNode(V, C))
- eval: (%, SplittingNode(V, C), SplittingNode(V, C)) -> % if SplittingNode(V, C) has Evalable SplittingNode(V, C)
from InnerEvalable(SplittingNode(V, C), SplittingNode(V, C))
- every?: (SplittingNode(V, C) -> Boolean, %) -> Boolean
from HomogeneousAggregate SplittingNode(V, C)
- extractSplittingLeaf: % -> Union(%, failed)
extractSplittingLeaf(a)
returns the left most leaf (as a tree) whose status isfalse
if any, else “failed” is returned.
- latex: % -> String
from SetCategory
- leaf?: % -> Boolean
from RecursiveAggregate SplittingNode(V, C)
- leaves: % -> List SplittingNode(V, C)
from RecursiveAggregate SplittingNode(V, C)
- less?: (%, NonNegativeInteger) -> Boolean
from Aggregate
- map!: (SplittingNode(V, C) -> SplittingNode(V, C), %) -> %
from HomogeneousAggregate SplittingNode(V, C)
- map: (SplittingNode(V, C) -> SplittingNode(V, C), %) -> %
from HomogeneousAggregate SplittingNode(V, C)
- max: % -> SplittingNode(V, C) if SplittingNode(V, C) has OrderedSet
from HomogeneousAggregate SplittingNode(V, C)
- max: ((SplittingNode(V, C), SplittingNode(V, C)) -> Boolean, %) -> SplittingNode(V, C)
from HomogeneousAggregate SplittingNode(V, C)
- member?: (SplittingNode(V, C), %) -> Boolean
from HomogeneousAggregate SplittingNode(V, C)
- members: % -> List SplittingNode(V, C)
from HomogeneousAggregate SplittingNode(V, C)
- min: % -> SplittingNode(V, C) if SplittingNode(V, C) has OrderedSet
from HomogeneousAggregate SplittingNode(V, C)
- more?: (%, NonNegativeInteger) -> Boolean
from Aggregate
- node?: (%, %) -> Boolean
from RecursiveAggregate SplittingNode(V, C)
- nodeOf?: (SplittingNode(V, C), %) -> Boolean
nodeOf?(s, a)
returnstrue
iff some node ofa
is equal tos
- nodes: % -> List %
from RecursiveAggregate SplittingNode(V, C)
- parts: % -> List SplittingNode(V, C)
from HomogeneousAggregate SplittingNode(V, C)
- remove!: (SplittingNode(V, C), %) -> %
remove!(s, a)
replaces a by remove(s
, a)
- remove: (SplittingNode(V, C), %) -> %
remove(s, a)
returns the splitting tree obtained from a by removing every sub-treeb
such thatvalue(b)
ands
have the same value, condition and status.
- result: % -> List Record(val: V, tower: C)
result(a)
wherels
is the leaves list ofa
returns[[value(s), condition(s)]\$VT for s in ls]
if the computations are terminated ina
else an error is produced.
- setchildren!: (%, List %) -> %
from RecursiveAggregate SplittingNode(V, C)
- setelt!: (%, value, SplittingNode(V, C)) -> SplittingNode(V, C)
from RecursiveAggregate SplittingNode(V, C)
- setvalue!: (%, SplittingNode(V, C)) -> SplittingNode(V, C)
from RecursiveAggregate SplittingNode(V, C)
- size?: (%, NonNegativeInteger) -> Boolean
from Aggregate
- splitNodeOf!: (%, %, List SplittingNode(V, C)) -> %
splitNodeOf!(l, a, ls)
returnsa
where the children list ofl
has been set to[[s]\$\% for s in ls | not nodeOf?(s, a)]
. Thus, ifl
is not a node ofa
, this latter splitting tree is unchanged.
- splitNodeOf!: (%, %, List SplittingNode(V, C), (C, C) -> Boolean) -> %
splitNodeOf!(l, a, ls, sub?)
returnsa
where the children list ofl
has been set to[[s]\$\% for s in ls | not subNodeOf?(s, a, sub?)]
. Thus, ifl
is not a node ofa
, this latter splitting tree is unchanged.
- subNodeOf?: (SplittingNode(V, C), %, (C, C) -> Boolean) -> Boolean
subNodeOf?(s, a, sub?)
returnstrue
iff for some noden
ina
we haves = n
orstatus(n)
andsubNode?(s, n, sub?)
.
- updateStatus!: % -> %
updateStatus!(a)
returns a where the status of the vertices are updated to satisfy the “termination condition”.
- value: % -> SplittingNode(V, C)
from RecursiveAggregate SplittingNode(V, C)
Evalable SplittingNode(V, C) if SplittingNode(V, C) has Evalable SplittingNode(V, C)
HomogeneousAggregate SplittingNode(V, C)
InnerEvalable(SplittingNode(V, C), SplittingNode(V, C)) if SplittingNode(V, C) has Evalable SplittingNode(V, C)